Improved code style
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
package expression_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/expression"
|
||||
@ -110,14 +110,11 @@ func TestParse(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.Name, func(t *testing.T) {
|
||||
src := []byte(test.Expression)
|
||||
tokens := token.Tokenize(src)
|
||||
expr := expression.Parse(tokens)
|
||||
defer expr.Reset()
|
||||
|
||||
assert.NotNil(t, expr)
|
||||
assert.Equal(t, expr.String(src), test.Result)
|
||||
})
|
||||
@ -150,7 +147,7 @@ func TestEachLeaf(t *testing.T) {
|
||||
assert.DeepEqual(t, leaves, []string{"1", "2", "3", "4", "5", "6", "7", "8"})
|
||||
|
||||
err = expr.EachLeaf(func(leaf *expression.Expression) error {
|
||||
return fmt.Errorf("error")
|
||||
return errors.New("error")
|
||||
})
|
||||
|
||||
assert.NotNil(t, err)
|
||||
|
Reference in New Issue
Block a user