about summary refs log tree commit diff
path: root/pkg/lang/vm/vm_test.go
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-05-29 21:42:32 +0000
committerGitHub <noreply@github.com>2022-05-29 21:42:32 +0000
commitd2f69dccb3643834a79da79be4ece189a7178c9e (patch)
tree7e32365a25f37bee199dde36dfdfef12916de46f /pkg/lang/vm/vm_test.go
parent11bcf772bf8d9aa353eb4c04bfb85378ba392b1e (diff)
downloadjinx-d2f69dccb3643834a79da79be4ece189a7178c9e.tar.zst
jinx-d2f69dccb3643834a79da79be4ece189a7178c9e.zip
Types, Methods and basic Core Lib
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)