summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-11-26 00:28:36 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-11-26 11:42:02 +0900
commit7fe7b7bc5a7a3d79280c9dbf2a2383d386386b0f (patch)
tree2894afd71d3565eefefad51952a854e08df9da3e /test/ruby
parent003f06bde40008159e871411cae5a928121490ba (diff)
Fix portability of bignum in ISeq Binary Format
- Unless `sizeof(BDIGIT) == 4`, (8-byte integer not available), the size to be loaded was wrong. - Since `BDIGIT`s are dumped as raw binary, the loaded byte order was inverted unless little-endian.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_iseq.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 6a1a1ea8c1..f05d067ac2 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -791,4 +791,11 @@ class TestISeq < Test::Unit::TestCase
end
end;
end
+
+ def test_ibf_bignum
+ iseq = RubyVM::InstructionSequence.compile("0x0"+"_0123_4567_89ab_cdef"*5)
+ expected = iseq.eval
+ result = RubyVM::InstructionSequence.load_from_binary(iseq.to_binary).eval
+ assert_equal expected, result, proc {sprintf("expected: %x, result: %x", expected, result)}
+ end
end