diff options
author | Kazuki Tsujimoto <kazuki@callcc.net> | 2019-11-19 08:53:01 -0600 |
---|---|---|
committer | Kazuki Tsujimoto <kazuki@callcc.net> | 2019-11-19 08:53:01 -0600 |
commit | 2439948bcc0ec9daf91cf79301195e59bad49aff (patch) | |
tree | 9603e001e41d33d231479ac6e1d63068ef56a033 /test/ruby | |
parent | 822d7ae31659e4ab60c4d1aa6d088577d6bc74b0 (diff) | |
download | ruby-2439948bcc0ec9daf91cf79301195e59bad49aff.tar.gz |
Avoid needless object allocation
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_pattern_matching.rb | 2 | ||||
-rw-r--r-- | test/ruby/test_struct.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb index 69524cb7a7..889f8dd519 100644 --- a/test/ruby/test_pattern_matching.rb +++ b/test/ruby/test_pattern_matching.rb @@ -1250,6 +1250,8 @@ END case s[a: 0, b: 1] in a:, c: flunk + in a:, b:, c: + flunk in b: b == 1 end diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb index 2c725f112f..2f5ef80c9b 100644 --- a/test/ruby/test_struct.rb +++ b/test/ruby/test_struct.rb @@ -437,7 +437,7 @@ module TestStruct assert_equal({a: 1, b: 2}, o.deconstruct_keys(nil)) assert_equal({a: 1, b: 2}, o.deconstruct_keys([:b, :a])) assert_equal({a: 1}, o.deconstruct_keys([:a])) - assert_equal({}, o.deconstruct_keys([:a, :c])) + assert_not_send([o.deconstruct_keys([:a, :c]), :key?, :c]) assert_raise(TypeError) { o.deconstruct_keys(0) } |