Skip to content

Commit

Permalink
Simplify error checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
RZhang05 committed Nov 13, 2024
1 parent ce4bb74 commit fab7567
Showing 1 changed file with 6 additions and 48 deletions.
54 changes: 6 additions & 48 deletions parser/expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6139,14 +6139,7 @@ func TestParseStringTemplate(t *testing.T) {
"this is a test \(FOO)
`)

var err error
if len(errs) > 0 {
err = Error{
Errors: errs,
}
}

require.Error(t, err)
require.NotEmpty(t, errs)
AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Expand All @@ -6166,14 +6159,7 @@ func TestParseStringTemplate(t *testing.T) {
"\(.)"
`)

var err error
if len(errs) > 0 {
err = Error{
Errors: errs,
}
}

require.Error(t, err)
require.NotEmpty(t, errs)
AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Expand Down Expand Up @@ -6250,14 +6236,7 @@ func TestParseStringTemplate(t *testing.T) {
"\()"
`)

var err error
if len(errs) > 0 {
err = Error{
Errors: errs,
}
}

require.Error(t, err)
require.NotEmpty(t, errs)
AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Expand Down Expand Up @@ -6295,14 +6274,7 @@ func TestParseStringTemplate(t *testing.T) {
"\(add"
`)

var err error
if len(errs) > 0 {
err = Error{
Errors: errs,
}
}

require.Error(t, err)
require.NotEmpty(t, errs)
AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Expand All @@ -6322,14 +6294,7 @@ func TestParseStringTemplate(t *testing.T) {
"\((2+2)/2()"
`)

var err error
if len(errs) > 0 {
err = Error{
Errors: errs,
}
}

require.Error(t, err)
require.NotEmpty(t, errs)
AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Expand All @@ -6349,14 +6314,7 @@ func TestParseStringTemplate(t *testing.T) {
"outer string \( "\(inner template)" )"
`)

var err error
if len(errs) > 0 {
err = Error{
Errors: errs,
}
}

require.Error(t, err)
require.NotEmpty(t, errs)
AssertEqualWithDiff(t,
[]error{
&SyntaxError{
Expand Down

0 comments on commit fab7567

Please sign in to comment.