parser_test.go: test added on isNil() function
This commit is contained in:
parent
3c0307524b
commit
475ef3c80a
@ -64,7 +64,7 @@ func TestParser(t *testing.T) {
|
|||||||
/* 43 */ {`+false`, nil, errors.New(`[1:2] prefix/postfix operator "+" do not support operand 'false' [bool]`)},
|
/* 43 */ {`+false`, nil, errors.New(`[1:2] prefix/postfix operator "+" do not support operand 'false' [bool]`)},
|
||||||
/* 44 */ {`false // very simple expression`, false, nil},
|
/* 44 */ {`false // very simple expression`, false, nil},
|
||||||
/* 45 */ {`1 + // Missing right operator`, nil, errors.New(`[1:4] infix operator "+" requires two non-nil operands, got 1`)},
|
/* 45 */ {`1 + // Missing right operator`, nil, errors.New(`[1:4] infix operator "+" requires two non-nil operands, got 1`)},
|
||||||
/* 46 */ {"", nil, errors.New(`empty expression`)},
|
/* 46 */ {"", nil, nil},
|
||||||
/* 47 */ {"4!", int64(24), nil},
|
/* 47 */ {"4!", int64(24), nil},
|
||||||
/* 48 */ {"(-4)!", nil, errors.New(`factorial of a negative integer (-4) is not allowed`)},
|
/* 48 */ {"(-4)!", nil, errors.New(`factorial of a negative integer (-4) is not allowed`)},
|
||||||
/* 49 */ {"-4!", int64(-24), nil},
|
/* 49 */ {"-4!", int64(-24), nil},
|
||||||
@ -158,6 +158,9 @@ func TestParser(t *testing.T) {
|
|||||||
/* 137 */ {`2 + 1 ? {"a"} : {"b"} * 3`, "2bbb", nil},
|
/* 137 */ {`2 + 1 ? {"a"} : {"b"} * 3`, "2bbb", nil},
|
||||||
/* 138 */ {`nil`, nil, nil},
|
/* 138 */ {`nil`, nil, nil},
|
||||||
/* 139 */ {`null`, nil, errors.New(`undefined variable "null"`)},
|
/* 139 */ {`null`, nil, errors.New(`undefined variable "null"`)},
|
||||||
|
/* 140 */ {`isNil(nil)`, true, nil},
|
||||||
|
/* 141 */ {`v=nil; isNil(v)`, true, nil},
|
||||||
|
/* 142 */ {`v=5; isNil(v)`, false, nil},
|
||||||
}
|
}
|
||||||
check_env_expr_path := 113
|
check_env_expr_path := 113
|
||||||
|
|
||||||
@ -165,7 +168,7 @@ func TestParser(t *testing.T) {
|
|||||||
failed := 0
|
failed := 0
|
||||||
|
|
||||||
// inputs1 := []inputType{
|
// inputs1 := []inputType{
|
||||||
// {`10 ? {"a"} :[true, 2+8] {"b"} :: {"c"}`, "b", nil},
|
// /* 140 */ {`isNil(nil)`, true, nil},
|
||||||
// }
|
// }
|
||||||
|
|
||||||
for i, input := range inputs {
|
for i, input := range inputs {
|
||||||
|
Loading…
Reference in New Issue
Block a user