Open headius opened 3 days ago
Note: We have test failures/errors in CI but we ignore them for now. We want to fix them.
https://github.com/ruby/stringio/actions/runs/11715704881/job/32632536169#step:9:8
===============================================================================
Failure: test_coderange_after_overwrite(TestStringIO):
<"\xD0\xB1\xD0\xBE\xD0\xB3\xD1\x83\xD1\x81">.ascii_only? is false value expected but was
<true>
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:1006:in `test_coderange_after_overwrite'
1003: s.rewind
1004: assert_predicate(s.string, :ascii_only?)
1005: s.write "\u{431 43e 433 443 441}"
=> 1006: assert_not_predicate(s.string, :ascii_only?)
1007:
1008: s = StringIO.new("\u{3042}")
1009: s.rewind
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
===============================================================================
Failure: test_each_byte_closed(TestStringIO): IOError expected but nothing was raised.
/home/runner/work/stringio/stringio/vendor/bundle/jruby/3.1.0/gems/test-unit-ruby-core-1.0.6/lib/core_assertions.rb:462:in `assert_raise'
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:481:in `test_each_byte_closed'
478: f = StringIO.new("1234")
479: assert_equal("1".ord, f.each_byte {|c| f.close; break c })
480: f = StringIO.new("1234")
=> 481: assert_raise(IOError) do
482: f.each_byte { f.close }
483: end
484: end
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
===============================================================================
Failure: test_each_codepoint_closed(TestStringIO): IOError expected but nothing was raised.
/home/runner/work/stringio/stringio/vendor/bundle/jruby/3.1.0/gems/test-unit-ruby-core-1.0.6/lib/core_assertions.rb:462:in `assert_raise'
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:578:in `test_each_codepoint_closed'
575: f = StringIO.new("1234")
576: assert_equal("1".ord, f.each_codepoint {|c| f.close; break c })
577: f = StringIO.new("1234")
=> 578: assert_raise(IOError) do
579: f.each_codepoint { f.close }
580: end
581: end
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
===============================================================================
Failure: test_each_codepoint_enumerator(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:590:in `test_each_codepoint_enumerator'
587: russian_part = io.read(40).force_encoding('UTF-8')
588:
589: assert_equal("你好", chinese_part)
=> 590: assert_equal("построить", russian_part)
591: end
592:
593: def test_gets2
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
<"построить"> expected but was
<"好построить">
diff:
? 好построить
===============================================================================
===============================================================================
Failure: test_encoding_read(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:970:in `test_encoding_read'
967:
968: def test_encoding_read
969: s = StringIO.new("abc".encode("utf-32be"), "r:utf-8")
=> 970: assert_equal("\0\0\0a\0\0\0b\0\0\0c", s.read)
971: end
972:
973: %w/UTF-8 UTF-16BE UTF-16LE UTF-32BE UTF-32LE/.each do |name|
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
<"\u0000\u0000\u0000a\u0000\u0000\u0000b\u0000\u0000\u0000c">(UTF-8) expected but was
<"abc">(UTF-32BE)
diff:
���a���b���c
? Encoding: UTF-8
? 32BE
? ?
===============================================================================
===============================================================================
Failure: test_encoding_write(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:965:in `test_encoding_write'
962: def test_encoding_write
963: s = StringIO.new("", "w:utf-32be")
964: s.print "abc"
=> 965: assert_equal("abc".encode("utf-32be"), s.string)
966: end
967:
968: def test_encoding_read
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
<"abc">(UTF-32BE) expected but was
<"abc">(UTF-8)
diff:
? ���a���b���c
? Encoding: UTF-32BE
? 8
? ????
===============================================================================
===============================================================================
Error: test_initialize(TestStringIO): TypeError: no implicit conversion of nil into String
org/jruby/ext/stringio/StringIO.java:275:in `initialize'
org/jruby/RubyClass.java:922:in `new'
org/jruby/ext/stringio/StringIO.java:170:in `new'
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:25:in `test_initialize'
22: assert_kind_of StringIO, StringIO.new
23: assert_kind_of StringIO, StringIO.new('str')
24: assert_kind_of StringIO, StringIO.new('str', 'r+')
=> 25: assert_kind_of StringIO, StringIO.new(nil)
26: assert_raise(ArgumentError) { StringIO.new('', 'x') }
27: assert_raise(ArgumentError) { StringIO.new('', 'rx') }
28: assert_raise(ArgumentError) { StringIO.new('', 'rbt') }
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
===============================================================================
Error: test_null(TestStringIO): TypeError: no implicit conversion of nil into String
org/jruby/ext/stringio/StringIO.java:275:in `initialize'
org/jruby/RubyClass.java:922:in `new'
org/jruby/ext/stringio/StringIO.java:170:in `new'
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:45:in `test_null'
42: end
43:
44: def test_null
=> 45: io = StringIO.new(nil)
46: assert_nil io.gets
47: io.puts "abc"
48: assert_nil io.string
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
===============================================================================
Error: test_pread(TestStringIO): EOFError: End of file reached
org/jruby/ext/stringio/StringIO.java:1110:in `pread'
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:782:in `test_pread'
779: assert_raise(ArgumentError) { f.pread(-1, 0) }
780: assert_raise(Errno::EINVAL) { f.pread(3, -1) }
781:
=> 782: assert_equal "".b, StringIO.new("").pread(0, 0)
783: assert_equal "".b, StringIO.new("").pread(0, -10)
784:
785: buf = "stale".b
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
===============================================================================
Failure: test_read(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:709:in `test_read'
706: s = ""
707: assert_equal(Encoding::UTF_8, s.encoding, bug20418)
708: f.read(4, s)
=> 709: assert_equal(Encoding::UTF_8, s.encoding, bug20418)
710:
711: f.rewind
712: s = ""
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
[Bug #20418] ™€®
<#<Encoding:UTF-8>> expected but was
<#<Encoding:ASCII-8BIT>>
diff:
? #<Encoding:UTF -8 >
? ASCII BIT
? ??? +++
===============================================================================
===============================================================================
Error: test_set_encoding(TestStringIO): ArgumentError: unknown encoding name - ISO-8859-16:ISO-8859-1
org/jruby/ext/stringio/StringIO.java:1630:in `set_encoding'
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:283:in `test_set_encoding'
280: assert_equal("foo\x83".b, f.gets)
281:
282: f = StringIO.new()
=> 283: f.set_encoding("ISO-8859-16:ISO-8859-1")
284: assert_equal(Encoding::ISO_8859_16, f.external_encoding)
285: assert_equal(Encoding::ISO_8859_16, f.string.encoding)
286: assert_nil(f.internal_encoding)
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
===============================================================================
Failure: test_strip_bom:UTF-16BE(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:978:in `block in TestStringIO'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
UTF-16BE
<#<Encoding:UTF-16BE>> expected but was
<#<Encoding:UTF-8>>
diff:
? #<Encoding:UTF-16BE>
? 8
? ????
===============================================================================
===============================================================================
Failure: test_strip_bom:UTF-16LE(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:978:in `block in TestStringIO'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
UTF-16LE
<#<Encoding:UTF-16LE>> expected but was
<#<Encoding:UTF-8>>
diff:
? #<Encoding:UTF-16LE>
? 8
? ????
===============================================================================
===============================================================================
Failure: test_strip_bom:UTF-32BE(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:978:in `block in TestStringIO'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
UTF-32BE
<#<Encoding:UTF-32BE>> expected but was
<#<Encoding:UTF-8>>
diff:
? #<Encoding:UTF-32BE>
? 8
? ????
===============================================================================
===============================================================================
Failure: test_strip_bom:UTF-32LE(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:978:in `block in TestStringIO'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
UTF-32LE
<#<Encoding:UTF-32LE>> expected but was
<#<Encoding:UTF-8>>
diff:
? #<Encoding:UTF-32LE>
? 8
? ????
===============================================================================
===============================================================================
Failure: test_strip_bom:UTF-8(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:979:in `block in TestStringIO'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
UTF-8
<"\xC4\x80a"> expected but was
<"\xEF\xBB\xBF\xC4\x80a">
diff:
? Āa
===============================================================================
===============================================================================
Failure: test_truncate(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:58:in `test_truncate'
55: io.puts "def"
56: assert_equal("\0\0\0\0def\n", io.string, "[ruby-dev:24190]")
57: assert_raise(Errno::EINVAL) { io.truncate(-1) }
=> 58: assert_equal(0, io.truncate(10))
59: assert_equal("\0\0\0\0def\n\0\0", io.string)
60: end
61:
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
<0> expected but was
<10>
diff:
? 10
===============================================================================
===============================================================================
Failure: test_ungetbyte_fill(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:886:in `test_ungetbyte_fill'
883: s = StringIO.new
884: s.print 'a' * count
885: s.ungetbyte('b' * (count * 5))
=> 886: assert_equal((count * 5), s.string.size)
887: assert_match(/\Ab+\z/, s.string)
888: end
889:
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
<500> expected but was
<900>
diff:
? 500
? 9
? ?
===============================================================================
===============================================================================
Failure: test_ungetc_fill(TestStringIO)
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:841:in `test_ungetc_fill'
838: s = StringIO.new
839: s.print 'a' * count
840: s.ungetc('b' * (count * 5))
=> 841: assert_equal((count * 5), s.string.size)
842: assert_match(/\Ab+\z/, s.string)
843: end
844:
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
<500> expected but was
<900>
diff:
? 500
? 9
? ?
===============================================================================
===============================================================================
Failure: test_write_encoding_conversion(TestStringIO):
1. [1/4] Assertion for "\"🍣\""
| Encoding::CompatibilityError expected but nothing was raised.
2. [2/4] Assertion for "\"あ🍣\""
| Encoding::CompatibilityError expected but nothing was raised.
3. [3/4] Assertion for "[\"あ\", \"🍣\"]"
| [Encoding::CompatibilityError] exception expected, not #<Java::JavaLang::RuntimeException: org.jruby.exceptions.EncodingError$CompatibilityError: (CompatibilityError) incompatible encodings: Windows-31J and UTF-8>.
4. [4/4] Assertion for "[\"a\", \"🍣\"]"
| Encoding::CompatibilityError expected but nothing was raised.
<false> is not true.
/home/runner/work/stringio/stringio/vendor/bundle/jruby/3.1.0/gems/test-unit-ruby-core-1.0.6/lib/core_assertions.rb:540:in `assert'
/home/runner/work/stringio/stringio/vendor/bundle/jruby/3.1.0/gems/test-unit-ruby-core-1.0.6/lib/core_assertions.rb:774:in `assert_all_assertions'
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:229:in `test_write_encoding_conversion'
226: s.write("foo".force_encoding("US-ASCII"), convertible)
227: assert_equal(Encoding::UTF_8, s.string.encoding)
228:
=> 229: all_assertions do |a|
230: [
231: inconvertible,
232: convertible + inconvertible,
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
===============================================================================
Failure: test_write_integer_overflow(TestStringIO): [ArgumentError] exception expected, not #<Java::JavaLang::ArrayIndexOutOfBoundsException: arraycopy: last destination index 2147483666 out of bounds for byte[0]>.
/home/runner/work/stringio/stringio/vendor/bundle/jruby/3.1.0/gems/test-unit-ruby-core-1.0.6/lib/core_assertions.rb:454:in `block in assert_raise'
/home/runner/work/stringio/stringio/vendor/bundle/jruby/3.1.0/gems/test-unit-ruby-core-1.0.6/lib/core_assertions.rb:540:in `assert'
/home/runner/work/stringio/stringio/vendor/bundle/jruby/3.1.0/gems/test-unit-ruby-core-1.0.6/lib/core_assertions.rb:453:in `assert_raise'
/home/runner/work/stringio/stringio/test/stringio/test_stringio.rb:249:in `test_write_integer_overflow'
246: def test_write_integer_overflow
247: f = StringIO.new
248: f.pos = StringIO::MAX_LENGTH
=> 249: assert_raise(ArgumentError) {
250: f.write("pos + len overflows")
251: }
252: end
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
org/jruby/RubyKernel.java:1426:in `catch'
org/jruby/RubyKernel.java:1421:in `catch'
===============================================================================
Finished in 0.833299 seconds.
93 tests, 565 assertions, 17 failures, 4 errors, 0 pendings, 1 omissions, 0 notifications
rake aborted!
The JRuby extension has diverged too much and needs some updates to pass all tests and specs. I'll look into it but if anyone wants to help, go for it.