From 8c96390ef465a82624e709bbd24051f9b0a450a0 Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Mon, 1 Jan 2018 19:55:36 -0800 Subject: [PATCH] Modifying test to look for a return statement instead of an expression. Also modifying the test name accordingly --- parser/parser_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parser/parser_test.go b/parser/parser_test.go index 3c4967d..e229489 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -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 := `

<%= if (x < y) { Hello Buffalo <% } %>` @@ -424,9 +424,9 @@ func Test_IfExpression_Replace_HTML_NoClosingTag(t *testing.T) { r.Equal("

", 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 }