mirror of
https://github.com/robertkrimen/otto
synced 2025-10-19 19:55:30 +08:00
26 lines
471 B
Go
26 lines
471 B
Go
package otto
|
|
|
|
import (
|
|
. "github.com/robertkrimen/terst"
|
|
"testing"
|
|
)
|
|
|
|
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")
|
|
}
|