From d2f69dccb3643834a79da79be4ece189a7178c9e Mon Sep 17 00:00:00 2001 From: Mel Date: Sun, 29 May 2022 21:42:32 +0000 Subject: Types, Methods and basic Core Lib --- pkg/lang/vm/vm_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'pkg/lang/vm/vm_test.go') 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) -- cgit 1.4.1