Skip to content

Commit

Permalink
adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Jan 5, 2023
1 parent 3574730 commit 4b3bd43
Showing 1 changed file with 38 additions and 44 deletions.
82 changes: 38 additions & 44 deletions runtime/parser/declaration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2192,15 +2192,10 @@ func TestParseField(t *testing.T) {

_, errs := parse("native let foo: Int", Config{})

utils.AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Message: "unexpected token: identifier",
Pos: ast.Position{Offset: 0, Line: 1, Column: 0},
},
},
errs,
)
// For now, leading unknown identifiers are valid.
// This will be rejected in Stable Cadence.

require.Empty(t, errs)
})

t.Run("static", func(t *testing.T) {
Expand Down Expand Up @@ -2250,15 +2245,10 @@ func TestParseField(t *testing.T) {
Config{},
)

utils.AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Message: "unexpected token: identifier",
Pos: ast.Position{Offset: 0, Line: 1, Column: 0},
},
},
errs,
)
// For now, leading unknown identifiers are valid.
// This will be rejected in Stable Cadence.

require.Empty(t, errs)
})

t.Run("static native, enabled", func(t *testing.T) {
Expand Down Expand Up @@ -2306,11 +2296,14 @@ func TestParseField(t *testing.T) {

_, errs := parse("static native let foo: Int", Config{})

// For now, leading unknown identifiers are valid.
// This will be rejected in Stable Cadence.

utils.AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Message: "unexpected token: identifier",
Pos: ast.Position{Offset: 0, Line: 1, Column: 0},
Message: "unexpected identifier",
Pos: ast.Position{Offset: 7, Line: 1, Column: 7},
},
},
errs,
Expand Down Expand Up @@ -2386,11 +2379,14 @@ func TestParseField(t *testing.T) {

_, errs := parse("pub static native let foo: Int", Config{})

// For now, leading unknown identifiers are valid.
// This will be rejected in Stable Cadence.

utils.AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Message: "unexpected token: identifier",
Pos: ast.Position{Offset: 4, Line: 1, Column: 4},
Message: "unexpected identifier",
Pos: ast.Position{Offset: 11, Line: 1, Column: 11},
},
},
errs,
Expand Down Expand Up @@ -2966,15 +2962,11 @@ func TestParseEnumDeclaration(t *testing.T) {
t.Parallel()

_, errs := testParseDeclarations(" enum E { static case e }")
utils.AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Message: "unexpected token: identifier",
Pos: ast.Position{Offset: 10, Line: 1, Column: 10},
},
},
errs,
)

// For now, leading unknown identifiers are valid.
// This will be rejected in Stable Cadence.

require.Empty(t, errs)
})

t.Run("enum case with native modifier, enabled", func(t *testing.T) {
Expand Down Expand Up @@ -3004,15 +2996,11 @@ func TestParseEnumDeclaration(t *testing.T) {
t.Parallel()

_, errs := testParseDeclarations(" enum E { native case e }")
utils.AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Message: "unexpected token: identifier",
Pos: ast.Position{Offset: 10, Line: 1, Column: 10},
},
},
errs,
)

// For now, leading unknown identifiers are valid.
// This will be rejected in Stable Cadence.

require.Empty(t, errs)
})
}

Expand Down Expand Up @@ -6308,11 +6296,14 @@ func TestParseNestedPragma(t *testing.T) {

_, errs := parse("static native #pragma", Config{})

// For now, leading unknown identifiers are valid.
// This will be rejected in Stable Cadence.

utils.AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Message: "unexpected token: identifier",
Pos: ast.Position{Offset: 0, Line: 1, Column: 0},
Message: "unexpected identifier",
Pos: ast.Position{Offset: 7, Line: 1, Column: 7},
},
},
errs,
Expand Down Expand Up @@ -6387,11 +6378,14 @@ func TestParseNestedPragma(t *testing.T) {

_, errs := parse("pub static native #pragma", Config{})

// For now, leading unknown identifiers are valid.
// This will be rejected in Stable Cadence.

utils.AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Message: "unexpected token: identifier",
Pos: ast.Position{Offset: 4, Line: 1, Column: 4},
Message: "unexpected identifier",
Pos: ast.Position{Offset: 11, Line: 1, Column: 11},
},
},
errs,
Expand Down

0 comments on commit 4b3bd43

Please sign in to comment.