diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-09-27 14:01:37 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-09-27 14:01:37 +0900 |
commit | 4d3502d57f53d5cd54452d9b19475944055989f4 (patch) | |
tree | fc73fdd7005384da404fa71a234d96dcf0a8214c /test/ruby | |
parent | eff15a269fdc37d2b09cf1dfe8c1b1bf6e377a32 (diff) | |
download | ruby-4d3502d57f53d5cd54452d9b19475944055989f4.tar.gz |
More tests for [Feature #16150]
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_object.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index fcb6c2826f..013b3f01f5 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -132,6 +132,27 @@ class TestObject < Test::Unit::TestCase assert_equal(0.0, nil.to_f) end + def test_nil_to_s + str = nil.to_s + assert_equal("", str) + assert_predicate(str, :frozen?) + assert_same(str, nil.to_s) + end + + def test_true_to_s + str = true.to_s + assert_equal("true", str) + assert_predicate(str, :frozen?) + assert_same(str, true.to_s) + end + + def test_false_to_s + str = false.to_s + assert_equal("false", str) + assert_predicate(str, :frozen?) + assert_same(str, false.to_s) + end + def test_not assert_equal(false, Object.new.send(:!)) assert_equal(true, nil.send(:!)) |