Expanded the lexer comment tests.
This commit is contained in:
parent
f1fcdfbacb
commit
192ba9bb54
|
@ -25,5 +25,31 @@ describe Oga::Lexer do
|
|||
[:T_COMMENT_END, '-->', 1, 9]
|
||||
]
|
||||
end
|
||||
|
||||
example 'lex a comment followed by text' do
|
||||
lex('<!---->foo').should == [
|
||||
[:T_COMMENT_START, '<!--', 1, 1],
|
||||
[:T_COMMENT_END, '-->', 1, 5],
|
||||
[:T_TEXT, 'foo', 1, 8]
|
||||
]
|
||||
end
|
||||
|
||||
example 'lex text followed by a comment' do
|
||||
lex('foo<!---->').should == [
|
||||
[:T_TEXT, 'foo', 1, 1],
|
||||
[:T_COMMENT_START, '<!--', 1, 4],
|
||||
[:T_COMMENT_END, '-->', 1, 8]
|
||||
]
|
||||
end
|
||||
|
||||
example 'lex an element followed by a comment' do
|
||||
lex('<p></p><!---->').should == [
|
||||
[:T_ELEM_OPEN, nil, 1, 1],
|
||||
[:T_ELEM_NAME, 'p', 1, 2],
|
||||
[:T_ELEM_CLOSE, nil, 1, 4],
|
||||
[:T_COMMENT_START, '<!--', 1, 8],
|
||||
[:T_COMMENT_END, '-->', 1, 12]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue