2017-12-17 11:41:25 +08:00
|
|
|
package eval
|
|
|
|
|
|
|
|
var builtinFnTests = []evalTest{
|
|
|
|
// Builtin functions
|
|
|
|
// -----------------
|
|
|
|
|
|
|
|
{"kind-of bare 'str' [] [&] []{ }",
|
|
|
|
want{out: strs("string", "string", "list", "map", "fn")}},
|
|
|
|
|
2017-12-17 13:26:37 +08:00
|
|
|
{`is 1 1`, wantTrue},
|
|
|
|
{`is [] []`, wantTrue},
|
|
|
|
{`is [1] [1]`, wantFalse},
|
|
|
|
{`eq 1 1`, wantTrue},
|
|
|
|
{`eq [] []`, wantTrue},
|
2017-12-17 11:41:25 +08:00
|
|
|
|
2017-12-17 13:20:03 +08:00
|
|
|
{`f=(constantly foo); $f; $f`, want{out: strs("foo", "foo")}},
|
|
|
|
{`(constantly foo) bad`, want{err: errAny}},
|
2017-12-17 11:41:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
addToEvalTests(builtinFnTests)
|
|
|
|
}
|