Skip to content

Commit

Permalink
some more advanced block lex tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoiron committed May 10, 2014
1 parent d8eb6b4 commit fa8e0b9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions neo/lex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,27 @@ func TestLexer(t *testing.T) {
ttEOF,
},
)

tester.Test(
`Hello. {% if true %}World{% else %}Nobody{% endif %}`,
[]tokenTest{
{tokenText, "Hello. "},
ttBlockBegin, sp,
{tokenName, "if"}, sp,
{tokenBool, "true"}, sp, ttBlockEnd,
{tokenText, "World"}, ttBlockBegin, sp,
{tokenName, "else"}, sp, ttBlockEnd,
{tokenText, "Nobody"}, ttBlockBegin, sp,
{tokenName, "endif"}, sp, ttBlockEnd, ttEOF,
},
)

tester.Test(
`<html>{# ignore {% tags %} in comments ##}</html>`,
[]tokenTest{
{tokenText, "<html>"}, ttCommentBegin,
{tokenText, " ignore {% tags %} in comments #"}, ttCommentEnd,
{tokenText, "</html>"}, ttEOF,
},
)
}

0 comments on commit fa8e0b9

Please sign in to comment.