pkg/eval: Test GoFn's Elvish value methods.

This commit is contained in:
Qi Xiao 2020-04-13 00:50:03 +01:00
parent 07a9e781a6
commit 7ad3f6aa24

View File

@ -3,11 +3,24 @@ package eval
import (
"errors"
"testing"
"unsafe"
"github.com/elves/elvish/pkg/eval/errs"
"github.com/elves/elvish/pkg/eval/vals"
"github.com/xiaq/persistent/hash"
)
func TestGoFnAsValue(t *testing.T) {
fn1 := NewGoFn("fn1", func() {})
fn2 := NewGoFn("fn2", func() {})
vals.TestValue(t, fn1).
Kind("fn").
Hash(hash.Pointer(unsafe.Pointer(fn1))).
Equal(fn1).
NotEqual(fn2).
Repr("<builtin fn1>")
}
type testOptions struct {
Foo string
Bar string