REF is tested ok

This commit is contained in:
lyon1998 2021-10-14 22:54:46 +08:00
parent edf3552aeb
commit 71bb89eb0c
2 changed files with 16 additions and 0 deletions

View File

@ -76,6 +76,19 @@ TEST(VM, str_xy_space) {
ASSERT_STREQ(obj_getStr(self, (char*)"a"), (char*)"xy ");
obj_deinit(self);
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}
TEST(VM, ref_a_b) {
Args* buffs = New_strBuff();
PikaObj* self = newRootObj((char*)"root", New_PikaStdLib_SysObj);
pikaVM_runAsm(self, pikaParseToAsm(buffs, (char*)"a = 'xy '"));
pikaVM_runAsm(self, pikaParseToAsm(buffs, (char*)"b = a"));
ASSERT_STREQ(obj_getStr(self, (char*)"b"), (char*)"xy ");
obj_deinit(self);
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);

View File

@ -69,6 +69,9 @@ Arg* pikaVM_runAsmInstruct(PikaObj* self,
arg_deinit(outArg);
return NULL;
}
if (instruct == REF) {
return arg_copy(obj_getArg(self, data));
}
return NULL;
}