mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
This reverts commit 26cb6ccce6
.
This commit is contained in:
parent
26cb6ccce6
commit
209b1fb8e8
|
@ -228,7 +228,7 @@ func Test_reflectStruct(t *testing.T) {
|
|||
|
||||
test(`
|
||||
ret = abc.FuncReturn2();
|
||||
if (ret && ret.length && ret.length == 2 && ret[0] == "def" && ret[1] === null) {
|
||||
if (ret && ret.length && ret.length == 2 && ret[0] == "def" && ret[1] === undefined) {
|
||||
true;
|
||||
} else {
|
||||
false;
|
||||
|
|
3
value.go
3
value.go
|
@ -325,7 +325,8 @@ func toValue(value interface{}) Value {
|
|||
case _result:
|
||||
return Value{valueResult, value}
|
||||
case nil:
|
||||
return nullValue
|
||||
// TODO Ugh.
|
||||
return Value{}
|
||||
case reflect.Value:
|
||||
for value.Kind() == reflect.Ptr {
|
||||
// We were given a pointer, so we'll drill down until we get a non-pointer
|
||||
|
|
|
@ -39,8 +39,7 @@ func TestToValue(t *testing.T) {
|
|||
vm := tester.vm
|
||||
|
||||
value, _ := vm.ToValue(nil)
|
||||
is(value, "null")
|
||||
is(value, nullValue)
|
||||
is(value, "undefined")
|
||||
|
||||
value, _ = vm.ToValue((*byte)(nil))
|
||||
is(value, "undefined")
|
||||
|
|
Loading…
Reference in New Issue
Block a user