diff options
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r-- | test/ruby/test_syntax.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 771764720b..ff8c62f6a1 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -515,8 +515,8 @@ WARN end def test_duplicated_when - w = 'warning: duplicated when clause is ignored' - assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){ + w = 'warning: duplicated `when\' clause with line 3 is ignored' + assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m) { eval %q{ case 1 when 1, 1 @@ -525,7 +525,7 @@ WARN end } } - assert_warning(/#{w}/){#/3: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){ + assert_warning(/#{w}/) {#/3: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m){ a = a = 1 eval %q{ case 1 @@ -537,6 +537,17 @@ WARN } end + def test_duplicated_when_check_option + w = /duplicated `when\' clause with line 3 is ignored/ + assert_in_out_err(%[-wc], "#{<<~"begin;"}\n#{<<~'end;'}", ["Syntax OK"], w) + begin; + case 1 + when 1 + when 1 + end + end; + end + def test_invalid_break assert_syntax_error("def m; break; end", /Invalid break/) assert_syntax_error('/#{break}/', /Invalid break/) |