diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-17 21:36:17 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-17 21:36:17 +0000 |
commit | 4cb618e7aacf84cf7c241ee0513bbb37e1068c9d (patch) | |
tree | 9022b6c440e8dcaf11d9f0eb04125ef84fb58677 /test | |
parent | b3b786c580995b31dcc0259890cefdb1385998c6 (diff) |
merge revision(s) 66760,66761,66824: [Backport #15460]
Follow behaviour of IO#ungetbyte
see r65802 and [Bug #14359]
* expand tabs.
setbyte / ungetbyte allow out-of-range integers
* string.c: String#setbyte to accept arbitrary integers [Bug #15460]
* io.c: ditto for IO#ungetbyte
* ext/strringio/stringio.c: ditto for StringIO#ungetbyte
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_m17n.rb | 14 | ||||
-rw-r--r-- | test/stringio/test_stringio.rb | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 0251315fcf..c1184c551f 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1526,13 +1526,13 @@ class TestM17N < Test::Unit::TestCase def test_setbyte_range s = u("\xE3\x81\x82\xE3\x81\x84") - assert_raise(RangeError) { s.setbyte(0, -1) } - assert_nothing_raised { s.setbyte(0, 0x00) } - assert_nothing_raised { s.setbyte(0, 0x7F) } - assert_nothing_raised { s.setbyte(0, 0x80) } - assert_nothing_raised { s.setbyte(0, 0xff) } - assert_raise(RangeError) { s.setbyte(0, 0x100) } - assert_raise(RangeError) { s.setbyte(0, 0x4f7574206f6620636861722072616e6765) } + assert_nothing_raised { s.setbyte(0, -1) } + assert_nothing_raised { s.setbyte(0, 0x00) } + assert_nothing_raised { s.setbyte(0, 0x7F) } + assert_nothing_raised { s.setbyte(0, 0x80) } + assert_nothing_raised { s.setbyte(0, 0xff) } + assert_nothing_raised { s.setbyte(0, 0x100) } + assert_nothing_raised { s.setbyte(0, 0x4f7574206f6620636861722072616e6765) } end def test_compatible diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 89da34e4ec..6d1a6ea8d5 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -452,6 +452,10 @@ class TestStringIO < Test::Unit::TestCase t.ungetbyte("\u{30eb 30d3 30fc}") assert_equal(0, t.pos) assert_equal("\u{30eb 30d3 30fc}\u7d05\u7389bar\n", s) + + assert_nothing_raised {t.ungetbyte(-1)} + assert_nothing_raised {t.ungetbyte(256)} + assert_nothing_raised {t.ungetbyte(1<<64)} end def test_ungetc |