about summary refs log tree commit diff
path: root/pkg/lang/vm/vm_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/lang/vm/vm_test.go')
-rw-r--r--pkg/lang/vm/vm_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/lang/vm/vm_test.go b/pkg/lang/vm/vm_test.go
index 9f6efc0..287e7a8 100644
--- a/pkg/lang/vm/vm_test.go
+++ b/pkg/lang/vm/vm_test.go
@@ -210,6 +210,25 @@ func TestMember(t *testing.T) {
 	test(t, src, "3")
 }
 
+func TestObject(t *testing.T) {
+	src := `
+	push_object
+
+	push_string "Petronij"
+	get_local 0
+	set_member "name"
+
+	push_int 10
+	get_local 0
+	set_member "age"
+
+	get_local 0
+	get_member "name"
+	`
+
+	test(t, src, "\"Petronij\"")
+}
+
 func test(t *testing.T, src string, expected string) {
 	bc := compile(t, src)
 	vm := vm.New(&bc)