1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00
otto/object_test.go
Robert Krimen 3c93384f5c Cleanup of stash, property, and object
Use octal to designate write/enumerate/configure (experimental)
Move extensibility responsibility into the stash
Rename propertyStash => objectStash (be congruent with arrayStash, etc.)
Get rid of a bunch of useless methods
Privatize everything ([A-Z] => [a-z_])
gofmt
2012-10-26 15:47:19 -07:00

26 lines
483 B
Go

package otto
import (
"testing"
. "github.com/robertkrimen/terst"
)
func TestObject_(t *testing.T) {
Terst(t)
object := newObject(nil, "")
IsTrue(object != nil)
object.put("xyzzy", toValue("Nothing happens."), true)
Is(object.get("xyzzy"), "Nothing happens.")
}
func TestStringObject(t *testing.T) {
Terst(t)
object := New().runtime.newStringObject(toValue("xyzzy"))
Is(object.get("1"), "y")
Is(object.get("10"), "undefined")
Is(object.get("2"), "z")
}