Skip to content

Commit

Permalink
Reorder imports. Fix some formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
rrb3942 committed Dec 4, 2023
1 parent b1b1b84 commit fe53377
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 4 additions & 2 deletions patchers/value/bench_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package value

import (
"testing"

"github.com/stretchr/testify/require"

"github.com/antonmedv/expr"
"github.com/antonmedv/expr/vm"
"github.com/stretchr/testify/require"
"testing"
)

func Benchmark_valueAdd(b *testing.B) {
Expand Down
1 change: 0 additions & 1 deletion patchers/value/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func (patcher) ApplyOptions(c *conf.Config) {
}

func getExprValue(params ...any) (any, error) {

switch v := params[0].(type) {
case ExprValuer:
return v.ExprValue(), nil
Expand Down
10 changes: 6 additions & 4 deletions patchers/value/value_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package value

import (
"testing"

"github.com/stretchr/testify/require"

"github.com/antonmedv/expr"
"github.com/antonmedv/expr/vm"
"github.com/stretchr/testify/require"
"testing"
)

type customInt struct {
Expand Down Expand Up @@ -145,7 +147,7 @@ func Test_valueUntypedAddMismatch(t *testing.T) {

func Test_valueTypedArray(t *testing.T) {
env := make(map[string]any)
env["ValueOne"] = &customTypedArray{[]any{ 1, 2 }}
env["ValueOne"] = &customTypedArray{[]any{1, 2}}

program, err := expr.Compile("ValueOne[0] + ValueOne[1]", expr.Env(env), Patcher)
require.NoError(t, err)
Expand All @@ -158,7 +160,7 @@ func Test_valueTypedArray(t *testing.T) {

func Test_valueTypedMap(t *testing.T) {
env := make(map[string]any)
env["ValueOne"] = &customTypedMap{map[string]any{ "one": 1, "two": 2 } }
env["ValueOne"] = &customTypedMap{map[string]any{"one": 1, "two": 2}}

program, err := expr.Compile("ValueOne.one + ValueOne.two", expr.Env(env), Patcher)
require.NoError(t, err)
Expand Down

0 comments on commit fe53377

Please sign in to comment.