Skip to content

Commit

Permalink
Clean up valid tests for string templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
RZhang05 committed Nov 14, 2024
1 parent fab7567 commit 7e35480
Showing 1 changed file with 9 additions and 72 deletions.
81 changes: 9 additions & 72 deletions parser/expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6054,14 +6054,7 @@ func TestParseStringTemplate(t *testing.T) {
"\(test)"
`)

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

require.NoError(t, err)
require.Empty(t, errs)

expected := &ast.StringTemplateExpression{
Values: []string{
Expand Down Expand Up @@ -6093,14 +6086,7 @@ func TestParseStringTemplate(t *testing.T) {
"this is a test \(abc)\(def) test"
`)

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

require.NoError(t, err)
require.Empty(t, errs)

expected := &ast.StringTemplateExpression{
Values: []string{
Expand Down Expand Up @@ -6179,14 +6165,7 @@ func TestParseStringTemplate(t *testing.T) {
"\(2 + 2) is a"
`)

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

require.NoError(t, err)
require.Empty(t, errs)
})

t.Run("valid, nested identifier", func(t *testing.T) {
Expand All @@ -6197,14 +6176,7 @@ func TestParseStringTemplate(t *testing.T) {
"\((a))"
`)

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

require.NoError(t, err)
require.Empty(t, errs)

expected := &ast.StringTemplateExpression{
Values: []string{
Expand Down Expand Up @@ -6256,14 +6228,7 @@ func TestParseStringTemplate(t *testing.T) {
"\(add())"
`)

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

require.NoError(t, err)
require.Empty(t, errs)
})

t.Run("invalid, missing paren", func(t *testing.T) {
Expand Down Expand Up @@ -6334,14 +6299,7 @@ func TestParseStringTemplate(t *testing.T) {
"a\(b)c"
`)

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

require.NoError(t, err)
require.Empty(t, errs)

expected := &ast.StringTemplateExpression{
Values: []string{
Expand Down Expand Up @@ -6373,14 +6331,7 @@ func TestParseStringTemplate(t *testing.T) {
"\(a)b\(c)"
`)

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

require.NoError(t, err)
require.Empty(t, errs)

expected := &ast.StringTemplateExpression{
Values: []string{
Expand Down Expand Up @@ -6419,14 +6370,7 @@ func TestParseStringTemplate(t *testing.T) {
"\(a)\(b)\(c)"
`)

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

require.NoError(t, err)
require.Empty(t, errs)

expected := &ast.StringTemplateExpression{
Values: []string{
Expand Down Expand Up @@ -6472,14 +6416,7 @@ func TestParseStringTemplate(t *testing.T) {
"\(a))"
`)

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

require.NoError(t, err)
require.Empty(t, errs)

expected := &ast.StringTemplateExpression{
Values: []string{
Expand Down

0 comments on commit 7e35480

Please sign in to comment.