diff --git a/pkg/eval/vals/concat_test.go b/pkg/eval/vals/concat_test.go index cf10c889..aad92d4c 100644 --- a/pkg/eval/vals/concat_test.go +++ b/pkg/eval/vals/concat_test.go @@ -51,7 +51,7 @@ func TestConcat(t *testing.T) { Args(concatter{}, "bar").Rets("concatter bar", nil), // LHS implements Concatter but returns ErrConcatNotImplemented; RHS // does not implement RConcatter - Args(concatter{}, 12).Rets(nil, cannotConcat{"!!vals.concatter", "!!int"}), + Args(concatter{}, 12).Rets(nil, cannotConcat{"!!vals.concatter", "number"}), // LHS implements Concatter but returns another error Args(concatter{}, 12.0).Rets(nil, errBadFloat64), diff --git a/pkg/eval/vals/kind.go b/pkg/eval/vals/kind.go index 882bb3ff..d19caf61 100644 --- a/pkg/eval/vals/kind.go +++ b/pkg/eval/vals/kind.go @@ -2,6 +2,7 @@ package vals import ( "fmt" + "math/big" ) // Kinder wraps the Kind method. @@ -27,7 +28,7 @@ func Kind(v interface{}) string { return "bool" case string: return "string" - case float64: + case int, *big.Int, *big.Rat, float64: return "number" case Kinder: return v.Kind() diff --git a/pkg/eval/vals/kind_test.go b/pkg/eval/vals/kind_test.go index fc6ef612..8288b729 100644 --- a/pkg/eval/vals/kind_test.go +++ b/pkg/eval/vals/kind_test.go @@ -1,6 +1,7 @@ package vals import ( + "math/big" "os" "testing" @@ -14,6 +15,9 @@ func TestKind(t *testing.T) { Args(nil).Rets("nil"), Args(true).Rets("bool"), Args("").Rets("string"), + Args(1).Rets("number"), + Args(bigInt(z)).Rets("number"), + Args(big.NewRat(1, 2)).Rets("number"), Args(1.0).Rets("number"), Args(os.Stdin).Rets("file"), Args(EmptyList).Rets("list"),