diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-19 05:20:21 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-19 05:20:21 +0000 |
commit | d20844c082c3fd4905e2cb9a6b318189d9ca1acb (patch) | |
tree | 55cf3c7f4e7a02a3e8a4f44b5041463132043376 /test/ruby | |
parent | 27fbfd88fa796e1a1dbfae9eddbdeb1d30f42825 (diff) | |
download | ruby-d20844c082c3fd4905e2cb9a6b318189d9ca1acb.tar.gz ruby-d20844c082c3fd4905e2cb9a6b318189d9ca1acb.tar.xz ruby-d20844c082c3fd4905e2cb9a6b318189d9ca1acb.zip |
* bootstraptest/test_knownbug.rb: move solved tests.
* bootstraptest/test_eval.rb, test_literal.rb, test_syntax.rb,
test_thread.rb: ditto.
* test/ruby/test_m17n.rb, test_proc.rb, test_sprintf.rb,
test_string.rb, test/ruby/test_struct.rb: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_m17n.rb | 9 | ||||
-rw-r--r-- | test/ruby/test_proc.rb | 12 | ||||
-rw-r--r-- | test/ruby/test_sprintf.rb | 1 | ||||
-rw-r--r-- | test/ruby/test_string.rb | 5 | ||||
-rw-r--r-- | test/ruby/test_struct.rb | 6 |
5 files changed, 33 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index a09dcc8f3..6f319b2b0 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1233,4 +1233,13 @@ class TestM17N < Test::Unit::TestCase s.setbyte(-4, 0x84) assert_equal(u("\xE3\x81\x84\xE3\x81\x84"), s) end + + def test_compatible + assert_equal(nil, Encoding.compatible?("",0), "moved from btest/knownbug") + end + + def test_force_encoding + assert(("".center(1, "\x80".force_encoding("utf-8")); true), + "moved from btest/knownbug, [ruby-dev:33807]") + end end diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 3c1ea7642..ee53eeaf3 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -210,6 +210,18 @@ class TestProc < Test::Unit::TestCase assert_equal(fib, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]) end + def test_curry_from_knownbug + a = lambda {|x, y, &b| b } + b = a.curry[1] + + assert_equal(:ok, + if b.call(2){} == nil + :ng + else + :ok + end, 'moved from btest/knownbug, [ruby-core:15551]') + end + def test_dup_clone b = proc {|x| x + "bar" } class << b; attr_accessor :foo; end diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb index ecb4ed120..cad9f5e03 100644 --- a/test/ruby/test_sprintf.rb +++ b/test/ruby/test_sprintf.rb @@ -185,6 +185,7 @@ class TestSprintf < Test::Unit::TestCase def test_float assert_equal("36893488147419111424", sprintf("%20.0f", 36893488147419107329.0)) + assert_equal(" Inf", sprintf("% 0e", 1.0/0.0), "moved from btest/knownbug") end BSIZ = 120 diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 648287a67..10e49708f 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -624,6 +624,8 @@ class TestString < Test::Unit::TestCase a.taint assert(a.gsub(/./, S('X')).tainted?) + assert_equal("z", "abc".gsub(/./, "a" => "z"), "moved from btest/knownbug") + assert_raise(ArgumentError) { "foo".gsub } end @@ -1063,6 +1065,9 @@ class TestString < Test::Unit::TestCase assert_equal([S("a"), S(""), S("b"), S("c"), S("")], S("a||b|c|").split(S('|'), -1)) assert_equal([], "".split(//, 1)) + + assert_equal("[2, 3]", [1,2,3].slice!(1,10000).inspect, "moved from btest/knownbug") + end def test_squeeze diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb index cbb0c1405..6c0e1f4fb 100644 --- a/test/ruby/test_struct.rb +++ b/test/ruby/test_struct.rb @@ -206,4 +206,10 @@ class TestStruct < Test::Unit::TestCase o = klass.new(1) assert_equal(1, o.size) end + + def test_error + assert_raise(TypeError){ + Struct.new(0) + } + end end |