mirror of
https://github.com/robertkrimen/otto
synced 2025-09-28 18:45:22 +08:00
26 lines
483 B
Go
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")
|
|
}
|