Skip to content

Commit

Permalink
Modifying test to look for a return statement
Browse files Browse the repository at this point in the history
instead of an expression. Also modifying the test name accordingly
  • Loading branch information
arschles committed Jan 2, 2018
1 parent 5a12403 commit 8c96390
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func Test_IfExpression_HTML_NoClosingTag(t *testing.T) {
// after that, parsing failed so don't expect any more expressions
}

func Test_IfExpression_Replace_HTML_NoClosingTag(t *testing.T) {
func Test_IfExpression_Return_HTML_NoClosingTag(t *testing.T) {
r := require.New(t)
// the template should have a missing '%>' after the if condition
input := `<p><%= if (x < y) { <title>Hello Buffalo</title> <% } %>`
Expand All @@ -424,9 +424,9 @@ func Test_IfExpression_Replace_HTML_NoClosingTag(t *testing.T) {
r.Equal("<p>", h.Value)

// the second should be the if condition
es2 := program.Statements[1].(*ast.ExpressionStatement)
ifExp := es2.Expression.(*ast.IfExpression)
r.Equal("(x < y)", ifExp.Condition.String())
es2 := program.Statements[1].(*ast.ReturnStatement)
retVal := es2.ReturnValue.(*ast.IfExpression)
r.Equal("(x < y)", retVal.Condition.String())

// after that, parsing failed so don't expect any more expressions
}
Expand Down

0 comments on commit 8c96390

Please sign in to comment.