Improved code style

This commit is contained in:
2025-01-30 22:23:38 +01:00
parent 162824ec1c
commit 313302b9c8
12 changed files with 17 additions and 22 deletions

View File

@ -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)