mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
Make sure delete([].xyzzy) (Array) actually works
This commit is contained in:
parent
0da0545485
commit
9f1daa280e
|
@ -24,9 +24,11 @@ func TestArray(t *testing.T) {
|
|||
|
||||
test(`
|
||||
abc = [0, 1, 2, 3];
|
||||
abc.xyzzy = "Nothing happens.";
|
||||
delete abc[1];
|
||||
abc;
|
||||
`, "0,,2,3")
|
||||
var xyzzy = delete abc.xyzzy;
|
||||
[ abc, xyzzy, abc.xyzzy ];
|
||||
`, "0,,2,3,true,")
|
||||
}
|
||||
|
||||
func TestArray_toString(t *testing.T) {
|
||||
|
|
|
@ -165,5 +165,8 @@ func (self *_arrayStash) delete(name string) {
|
|||
if index < int64(len(self.valueArray)) {
|
||||
self.valueArray[index] = emptyValue()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
self._stash.delete(name)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user