aboutsummaryrefslogtreecommitdiff
path: root/parser/parser_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'parser/parser_test.go')
-rw-r--r--parser/parser_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/parser/parser_test.go b/parser/parser_test.go
index b451ddf..7fe5268 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -711,6 +711,9 @@ func TestParsingEmptyArrayLiterals(t *testing.T) {
checkParserErrors(t, p)
stmt, ok := program.Statements[0].(*ast.ExpressionStatement)
+ if !ok {
+ t.Fatalf("stmt not ast.EspressionStatement. got=%T", stmt)
+ }
array, ok := stmt.Expression.(*ast.ArrayLiteral)
if !ok {
t.Fatalf("exp not ast.ArrayLiteral. got=%T", stmt.Expression)
@@ -730,6 +733,9 @@ func TestParsingArrayLiterals(t *testing.T) {
checkParserErrors(t, p)
stmt, ok := program.Statements[0].(*ast.ExpressionStatement)
+ if !ok {
+ t.Fatalf("stmt not ast.EspressionStatement. got=%T", stmt)
+ }
array, ok := stmt.Expression.(*ast.ArrayLiteral)
if !ok {
t.Fatalf("exp not ast.ArrayLiteral. got=%T", stmt.Expression)
@@ -753,6 +759,9 @@ func TestParsingIndexExpressions(t *testing.T) {
checkParserErrors(t, p)
stmt, ok := program.Statements[0].(*ast.ExpressionStatement)
+ if !ok {
+ t.Fatalf("stmt not ast.EspressionStatement. got=%T", stmt)
+ }
indexExp, ok := stmt.Expression.(*ast.IndexExpression)
if !ok {
t.Fatalf("exp not *ast.IndexExpression. got=%T", stmt.Expression)