diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-29 13:33:26 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-29 13:33:26 +0000 |
commit | 2d97d3ddac90777a9df4edea9c445155e42f30b7 (patch) | |
tree | 51c4dad578e11e5abfd6025f46528f52de6a4fc5 /test/ruby/test_string.rb | |
parent | daa622aed079b4434e607820d7577b4a7d4f2bfc (diff) | |
download | ruby-2d97d3ddac90777a9df4edea9c445155e42f30b7.tar.gz |
* string.c (rb_str_chomp_bang): now works on UTF-16.
* string.c (tr_setup_table): negation should work on non ASCII
compatible strings as well.
* string.c (rb_str_split_m): awk split should work on non ASCII
compatible strings as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index d0984e8fdb..647babb663 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -280,6 +280,7 @@ class TestString < Test::Unit::TestCase def test_chomp assert_equal(S("hello"), S("hello").chomp("\n")) assert_equal(S("hello"), S("hello\n").chomp("\n")) + save = $/ $/ = "\n" @@ -289,7 +290,7 @@ class TestString < Test::Unit::TestCase $/ = "!" assert_equal(S("hello"), S("hello").chomp) assert_equal(S("hello"), S("hello!").chomp) - $/ = "\n" + $/ = save end def test_chomp! @@ -302,6 +303,7 @@ class TestString < Test::Unit::TestCase a = S("hello\n") a.chomp!(S("\n")) assert_equal(S("hello"), a) + save = $/ $/ = "\n" a = S("hello") @@ -321,7 +323,7 @@ class TestString < Test::Unit::TestCase a.chomp! assert_equal(S("hello"), a) - $/ = "\n" + $/ = save a = S("hello\n") b = a.dup @@ -474,6 +476,7 @@ class TestString < Test::Unit::TestCase end def test_each + save = $/ $/ = "\n" res=[] S("hello\nworld").lines.each {|x| res << x} @@ -490,7 +493,7 @@ class TestString < Test::Unit::TestCase S("hello!world").lines.each {|x| res << x} assert_equal(S("hello!"), res[0]) assert_equal(S("world"), res[1]) - $/ = "\n" + $/ = save end def test_each_byte @@ -502,6 +505,7 @@ class TestString < Test::Unit::TestCase end def test_each_line + save = $/ $/ = "\n" res=[] S("hello\nworld").lines.each {|x| res << x} @@ -520,7 +524,7 @@ class TestString < Test::Unit::TestCase assert_equal(S("hello!"), res[0]) assert_equal(S("world"), res[1]) - $/ = "\n" + $/ = save end def test_empty? |