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.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/lang/vm/vm_test.go b/pkg/lang/vm/vm_test.go
index fd4f961..53b7c3c 100644
--- a/pkg/lang/vm/vm_test.go
+++ b/pkg/lang/vm/vm_test.go
@@ -185,6 +185,29 @@ func TestEscapedEnv(t *testing.T) {
 	test(t, src, "[1, 2, 3]")
 }
 
+func TestMember(t *testing.T) {
+	src := `
+	push_array
+
+	push_int 1
+	get_local 0
+	temp_arr_push
+
+	push_int 2
+	get_local 0
+	temp_arr_push
+
+	push_int 3
+	get_local 0
+	temp_arr_push
+
+	get_member "length"
+	call
+	`
+
+	test(t, src, "3")
+}
+
 func test(t *testing.T, src string, expected string) {
 	bc := compile(t, src)
 	vm := vm.New(&bc)