@@ -62,6 +62,17 @@ def test_class_tokenize___END__
6262 assert_equal expected , tokens
6363 end
6464
65+ def test_class_tokenize___ENCODING__
66+ tokens = RDoc ::RubyLex . tokenize '__ENCODING__' , nil
67+
68+ expected = [
69+ @TK ::Tk__ENCODING__ . new ( 0 , 1 , 0 , '__ENCODING__' ) ,
70+ @TK ::TkNL . new ( 12 , 1 , 12 , "\n " ) ,
71+ ]
72+
73+ assert_equal expected , tokens
74+ end
75+
6576 def test_class_tokenize_character_literal
6677 tokens = RDoc ::RubyLex . tokenize "?c" , nil
6778
@@ -827,6 +838,36 @@ def test_class_tokenize_particular_kind_of_symbols
827838 assert_equal expected , tokens
828839 end
829840
841+ def test_class_tokenize_symbol_with_quote
842+ tokens = RDoc ::RubyLex . tokenize <<RUBY , nil
843+ a.include?()?"a":"b"
844+ {"t":1,'t2':2}
845+ RUBY
846+
847+ expected = [
848+ @TK ::TkIDENTIFIER . new ( 0 , 1 , 0 , "a" ) ,
849+ @TK ::TkDOT . new ( 1 , 1 , 1 , "." ) ,
850+ @TK ::TkFID . new ( 2 , 1 , 2 , "include?" ) ,
851+ @TK ::TkLPAREN . new ( 10 , 1 , 10 , "(" ) ,
852+ @TK ::TkRPAREN . new ( 11 , 1 , 11 , ")" ) ,
853+ @TK ::TkQUESTION . new ( 12 , 1 , 12 , "?" ) ,
854+ @TK ::TkSTRING . new ( 13 , 1 , 13 , "\" a\" " ) ,
855+ @TK ::TkCOLON . new ( 16 , 1 , 16 , ":" ) ,
856+ @TK ::TkSTRING . new ( 17 , 1 , 17 , "\" b\" " ) ,
857+ @TK ::TkNL . new ( 20 , 1 , 20 , "\n " ) ,
858+ @TK ::TkLBRACE . new ( 21 , 2 , 0 , "{" ) ,
859+ @TK ::TkSYMBOL . new ( 22 , 2 , 1 , "\" t\" :" ) ,
860+ @TK ::TkINTEGER . new ( 26 , 2 , 5 , "1" ) ,
861+ @TK ::TkCOMMA . new ( 27 , 2 , 6 , "," ) ,
862+ @TK ::TkSYMBOL . new ( 28 , 2 , 7 , "'t2':" ) ,
863+ @TK ::TkINTEGER . new ( 33 , 2 , 12 , "2" ) ,
864+ @TK ::TkRBRACE . new ( 34 , 2 , 13 , "}" ) ,
865+ @TK ::TkNL . new ( 35 , 2 , 21 , "\n " ) ,
866+ ]
867+
868+ assert_equal expected , tokens
869+ end
870+
830871 def test_unary_minus
831872 ruby_lex = RDoc ::RubyLex . new ( "-1" , nil )
832873 assert_equal ( "-1" , ruby_lex . token . value )
0 commit comments