summaryrefslogtreecommitdiff
path: root/test/ripper
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-06 08:25:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-06 08:25:50 +0000
commit68a44cd169e5c9c1d2150e1f3932da8c4cb2c013 (patch)
tree253100a3bb7f00d009cb6840b709929e673538b8 /test/ripper
parentd3a2aa40042e5c7fce409866a65e815c23ad2f70 (diff)
test_scanner_events.rb: ruby-mode highlight by heredoc
* test/ripper/test_scanner_events.rb (TestRipper::ScannerEvents): get rid of make ruby-mode highlight confused by heredoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper')
-rw-r--r--test/ripper/test_scanner_events.rb78
1 files changed, 39 insertions, 39 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index bcbbf01..c1b72c2 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -32,10 +32,10 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
Ripper.tokenize('1')
assert_equal ['1', ';', 'def', ' ', 'm', '(', 'arg', ')', 'end'],
Ripper.tokenize("1;def m(arg)end")
- assert_equal ['print', '(', '<<EOS', ')', "\n", "heredoc\n", "EOS\n"],
- Ripper.tokenize("print(<<EOS)\nheredoc\nEOS\n")
- assert_equal ['print', '(', ' ', '<<EOS', ')', "\n", "heredoc\n", "EOS\n"],
- Ripper.tokenize("print( <<EOS)\nheredoc\nEOS\n")
+ assert_equal ['print', '(', '<<''EOS', ')', "\n", "heredoc\n", "EOS\n"],
+ Ripper.tokenize("print(<<""EOS)\nheredoc\nEOS\n")
+ assert_equal ['print', '(', ' ', '<<''EOS', ')', "\n", "heredoc\n", "EOS\n"],
+ Ripper.tokenize("print( <<""EOS)\nheredoc\nEOS\n")
assert_equal ["\#\n", "\n", "\#\n", "\n", "nil", "\n"],
Ripper.tokenize("\#\n\n\#\n\nnil\n")
end
@@ -61,15 +61,15 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
[[2, 1], :on_nl, "\n"],
[[3, 0], :on_int, "3"]],
Ripper.lex("1\n2\n3")
- assert_equal [[[1, 0], :on_heredoc_beg, "<<EOS"],
+ assert_equal [[[1, 0], :on_heredoc_beg, "<<""EOS"],
[[1, 5], :on_nl, "\n"],
[[2, 0], :on_tstring_content, "heredoc\n"],
[[3, 0], :on_heredoc_end, "EOS"]],
- Ripper.lex("<<EOS\nheredoc\nEOS")
- assert_equal [[[1, 0], :on_heredoc_beg, "<<EOS"],
+ Ripper.lex("<<""EOS\nheredoc\nEOS")
+ assert_equal [[[1, 0], :on_heredoc_beg, "<<""EOS"],
[[1, 5], :on_nl, "\n"],
[[2, 0], :on_heredoc_end, "EOS"]],
- Ripper.lex("<<EOS\nEOS"),
+ Ripper.lex("<<""EOS\nEOS"),
"bug#4543"
assert_equal [[[1, 0], :on_regexp_beg, "/"],
[[1, 1], :on_tstring_content, "foo\nbar"],
@@ -107,7 +107,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
validate_location "BEGIN{print nil}"
validate_location "%w(a b\nc\r\nd \ne )"
validate_location %Q["a\nb\r\nc"]
- validate_location "print(<<EOS)\nheredoc\nEOS\n"
+ validate_location "print(<<""EOS)\nheredoc\nEOS\n"
validate_location "print(<<-\"EOS\")\nheredoc\n EOS\n"
end
@@ -140,7 +140,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal [],
scan('comma', %q[".,.,.,.,.,.,.."])
assert_equal [],
- scan('comma', "<<EOS\n,,,,,,,,,,\nEOS")
+ scan('comma', "<<""EOS\n,,,,,,,,,,\nEOS")
end
def test_period
@@ -206,7 +206,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal ['#{'],
scan('embexpr_beg', '%Q[#{expr}]')
assert_equal ['#{'],
- scan('embexpr_beg', "m(<<EOS)\n\#{expr}\nEOS")
+ scan('embexpr_beg', "m(<<""EOS)\n\#{expr}\nEOS")
end
def test_embexpr_end
@@ -219,7 +219,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal ['}'],
scan('embexpr_end', '%Q[#{expr}]')
assert_equal ['}'],
- scan('embexpr_end', "m(<<EOS)\n\#{expr}\nEOS")
+ scan('embexpr_end', "m(<<""EOS)\n\#{expr}\nEOS")
end
def test_embvar
@@ -480,8 +480,8 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('op', '1 < 1')
assert_equal ['<='],
scan('op', '1 <= 1')
- assert_equal ['<<'],
- scan('op', '1 << 1')
+ assert_equal ['<''<'],
+ scan('op', '1 <''< 1')
assert_equal ['>>'],
scan('op', '1 >> 1')
assert_equal ['+'],
@@ -647,51 +647,51 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
def test_heredoc_beg
assert_equal [],
scan('heredoc_beg', '')
- assert_equal ['<<EOS'],
- scan('heredoc_beg', "<<EOS\nheredoc\nEOS")
- assert_equal ['<<EOS'],
- scan('heredoc_beg', "<<EOS\nheredoc\nEOS\n")
- assert_equal ['<<EOS'],
- scan('heredoc_beg', "<<EOS\nheredoc\nEOS \n")
- assert_equal ['<<-EOS'],
- scan('heredoc_beg', "<<-EOS\nheredoc\n\tEOS \n")
- assert_equal ['<<"EOS"'],
- scan('heredoc_beg', '<<"EOS"'"\nheredoc\nEOS")
- assert_equal ["<<'EOS'"],
- scan('heredoc_beg', "<<'EOS'\nheredoc\nEOS")
- assert_equal ['<<`EOS`'],
- scan('heredoc_beg', "<<`EOS`\nheredoc\nEOS")
- assert_equal ['<<" "'],
- scan('heredoc_beg', '<<" "'"\nheredoc\nEOS")
+ assert_equal ['<<''EOS'],
+ scan('heredoc_beg', "<<""EOS\nheredoc\nEOS")
+ assert_equal ['<<''EOS'],
+ scan('heredoc_beg', "<<""EOS\nheredoc\nEOS\n")
+ assert_equal ['<<''EOS'],
+ scan('heredoc_beg', "<<""EOS\nheredoc\nEOS \n")
+ assert_equal ['<<''-EOS'],
+ scan('heredoc_beg', "<<""-EOS\nheredoc\n\tEOS \n")
+ assert_equal ['<<''"EOS"'],
+ scan('heredoc_beg', '<<''"EOS"'"\nheredoc\nEOS")
+ assert_equal ["<<""'EOS'"],
+ scan('heredoc_beg', "<<""'EOS'\nheredoc\nEOS")
+ assert_equal ['<<''`EOS`'],
+ scan('heredoc_beg', "<<""`EOS`\nheredoc\nEOS")
+ assert_equal ['<<''" "'],
+ scan('heredoc_beg', '<<''" "'"\nheredoc\nEOS")
end
def test_tstring_content_HEREDOC
assert_equal [],
scan('tstring_content', '')
assert_equal ["heredoc\n"],
- scan('tstring_content', "<<EOS\nheredoc\nEOS")
+ scan('tstring_content', "<<""EOS\nheredoc\nEOS")
assert_equal ["heredoc\n"],
- scan('tstring_content', "<<EOS\nheredoc\nEOS\n")
+ scan('tstring_content', "<<""EOS\nheredoc\nEOS\n")
assert_equal ["here\ndoc \nEOS \n"],
- scan('tstring_content', "<<EOS\nhere\ndoc \nEOS \n")
+ scan('tstring_content', "<<""EOS\nhere\ndoc \nEOS \n")
assert_equal ["heredoc\n\tEOS \n"],
- scan('tstring_content', "<<-EOS\nheredoc\n\tEOS \n")
+ scan('tstring_content', "<<""-EOS\nheredoc\n\tEOS \n")
end
def test_heredoc_end
assert_equal [],
scan('heredoc_end', '')
assert_equal ["EOS"],
- scan('heredoc_end', "<<EOS\nEOS"),
+ scan('heredoc_end', "<<""EOS\nEOS"),
"bug#4543"
assert_equal ["EOS"],
- scan('heredoc_end', "<<EOS\nheredoc\nEOS")
+ scan('heredoc_end', "<<""EOS\nheredoc\nEOS")
assert_equal ["EOS\n"],
- scan('heredoc_end', "<<EOS\nheredoc\nEOS\n")
+ scan('heredoc_end', "<<""EOS\nheredoc\nEOS\n")
assert_equal [],
- scan('heredoc_end', "<<EOS\nheredoc\nEOS \n")
+ scan('heredoc_end', "<<""EOS\nheredoc\nEOS \n")
assert_equal [],
- scan('heredoc_end', "<<-EOS\nheredoc\n\tEOS \n")
+ scan('heredoc_end', "<<""-EOS\nheredoc\n\tEOS \n")
end
def test_semicolon