diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-29 01:09:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-29 01:09:40 +0000 |
commit | af1b9db40b31f5ef186799345931e1de59843892 (patch) | |
tree | d7e6c0431f0e96313f968d6a0c047f0d0568a34d /test | |
parent | 693eabb2be4a57f1300e6b73d6d8069b355782c6 (diff) | |
download | ruby-af1b9db40b31f5ef186799345931e1de59843892.tar.gz |
compile.c: not flip-flop
* compile.c (iseq_compile_each): turn flip-flop in a not-operator
into a boolean value. fix up r56315
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_flip.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_flip.rb b/test/ruby/test_flip.rb index 7c805574a8..810fd5d3ae 100644 --- a/test/ruby/test_flip.rb +++ b/test/ruby/test_flip.rb @@ -8,6 +8,8 @@ class TestFlip < Test::Unit::TestCase assert_equal [2], (1..9).select {|n| true if (n==2)..(n%2).zero?} assert_equal [2,3,4], (1..9).select {|n| true if (n==2)...(n%2).zero?} assert_equal [4,5,7,8], (1..9).select {|n| true if (n==4)...(n==5) or (n==7)...(n==8)} + assert_equal [nil, 2, 3, 4, nil], (1..5).map {|x| x if (x==2..x==4)} + assert_equal [1, nil, nil, nil, 5], (1..5).map {|x| x if !(x==2..x==4)} end def test_hidden_key |