Browse Source

Fixed parser tests (closes #96)

Dmitry Panov 6 years ago
parent
commit
1a71e42e74
2 changed files with 4 additions and 4 deletions
  1. 3 3
      parser/parser_test.go
  2. 1 1
      parser/testutil_test.go

+ 3 - 3
parser/parser_test.go

@@ -440,9 +440,9 @@ func TestParserErr(t *testing.T) {
 			};`, "(anonymous): Line 4:6 Unexpected identifier")
 			};`, "(anonymous): Line 4:6 Unexpected identifier")
 			test("{}", nil)
 			test("{}", nil)
 			test("{a: 1}", nil)
 			test("{a: 1}", nil)
-			test("{a: 1,}", nil)
-			test("{a: 1, b: 2}", nil)
-			test("{a: 1, b: 2,}", nil)
+			test("{a: 1,}", "(anonymous): Line 1:7 Unexpected token }")
+			test("{a: 1, b: 2}", "(anonymous): Line 1:9 Unexpected token :")
+			test("{a: 1, b: 2,}", "(anonymous): Line 1:9 Unexpected token :")
 		}
 		}
 
 
 		{ // Reserved words (strict)
 		{ // Reserved words (strict)

+ 1 - 1
parser/testutil_test.go

@@ -12,7 +12,7 @@ import (
 func tt(t *testing.T, f func()) {
 func tt(t *testing.T, f func()) {
 	defer func() {
 	defer func() {
 		if x := recover(); x != nil {
 		if x := recover(); x != nil {
-			_, file, line, _ := runtime.Caller(5)
+			_, file, line, _ := runtime.Caller(4)
 			t.Errorf("Error at %s:%d: %v", filepath.Base(file), line, x)
 			t.Errorf("Error at %s:%d: %v", filepath.Base(file), line, x)
 		}
 		}
 	}()
 	}()