Skip to content

Commit 323873a

Browse files
committed
Add quotes to error message
1 parent 3da8527 commit 323873a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

patcher/operator_override.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ func checkType(fnType conf.Tag, fn string, operator string) {
131131

132132
func checkFunc(fn *builtin.Function, name string, operator string) {
133133
if len(fn.Types) == 0 {
134-
panic(fmt.Errorf("function %s for %s operator misses types", name, operator))
134+
panic(fmt.Errorf("function %q for %q operator misses types", name, operator))
135135
}
136136
for _, t := range fn.Types {
137137
if t.NumIn() != 2 || t.NumOut() != 1 {
138-
panic(fmt.Errorf("function %s for %s operator does not have a correct signature", name, operator))
138+
panic(fmt.Errorf("function %q for %q operator does not have a correct signature", name, operator))
139139
}
140140
}
141141
}

test/operator/operator_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"testing"
66
"time"
77

8+
"github.com/stretchr/testify/assert"
89
"github.com/stretchr/testify/require"
910

1011
"github.com/expr-lang/expr"
@@ -108,7 +109,7 @@ func TestOperator_Function_WithTypes(t *testing.T) {
108109
"bar": Value{2},
109110
}
110111

111-
require.PanicsWithError(t, `function Add for + operator misses types`, func() {
112+
assert.PanicsWithError(t, `function "Add" for "+" operator misses types`, func() {
112113
_, _ = expr.Compile(
113114
`foo + bar`,
114115
expr.Env(env),
@@ -119,7 +120,7 @@ func TestOperator_Function_WithTypes(t *testing.T) {
119120
)
120121
})
121122

122-
require.PanicsWithError(t, `function Add for + operator does not have a correct signature`, func() {
123+
assert.PanicsWithError(t, `function "Add" for "+" operator does not have a correct signature`, func() {
123124
_, _ = expr.Compile(
124125
`foo + bar`,
125126
expr.Env(env),
@@ -131,7 +132,6 @@ func TestOperator_Function_WithTypes(t *testing.T) {
131132
),
132133
)
133134
})
134-
135135
}
136136

137137
func TestOperator_FunctionOverTypesPrecedence(t *testing.T) {

0 commit comments

Comments
 (0)