1
0
mirror of https://github.com/robertkrimen/otto synced 2025-09-28 18:45:22 +08:00
otto/stash_test.go
2012-10-05 18:47:53 -07:00

27 lines
528 B
Go

package otto
import (
"testing"
. "github.com/robertkrimen/terst"
)
func TestStash(t *testing.T) {
Terst(t)
stash := newPropertyStash(true)
IsTrue(stash.CanWrite("xyzzy"))
stash.Define("xyzzy", _defineProperty{
Value: toValue("Nothing happens."),
})
IsTrue(stash.CanRead("xyzzy"))
IsTrue(stash.CanWrite("xyzzy"))
stash.Define("xyzzy", _defineProperty{
Value: toValue("Something else happens."),
Write: propertyAttributeFalse,
})
IsTrue(stash.CanRead("xyzzy"))
IsFalse(stash.CanWrite("xyzzy"))
}