summaryrefslogtreecommitdiff
path: root/test/ruby/test_parse.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_parse.rb')
-rw-r--r--test/ruby/test_parse.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 0f71e11f7e..2f1a522dc2 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -465,6 +465,21 @@ class TestParse < Test::Unit::TestCase
assert_parse_error(%q[def (:"#{42}").foo; end], msg)
end
+ def test_flip_flop
+ [
+ '((cond1..cond2))',
+ '(; cond1..cond2)',
+ '(1; cond1..cond2)',
+ '(%s(); cond1..cond2)',
+ '(%w(); cond1..cond2)',
+ '(1; (2; (3; 4; cond1..cond2)))',
+ '(1+1; cond1..cond2)',
+ ].each do |code|
+ code = code.sub("cond1", "n==4").sub("cond2", "n==5")
+ assert_equal([4,5], eval("(1..9).select {|n| true if #{code}}"))
+ end
+ end
+
def test_op_asgn1_with_block
t = Object.new
a = []