mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
debug connot find object when run method of locals.obj
This commit is contained in:
parent
c63493050d
commit
ce3df083b6
@ -1,12 +1,31 @@
|
||||
// #include "gtest/gtest.h"
|
||||
// extern "C" {
|
||||
// #include "dataMemory.h"
|
||||
// #include "pikaScript.h"
|
||||
// }
|
||||
// extern PikaMemInfo pikaMemInfo;
|
||||
// TEST(pikaMain, init) {
|
||||
// pikaMemInfo.heapUsedMax = 0;
|
||||
// PikaObj* pikaMain = pikaScriptInit();
|
||||
// obj_deinit(pikaMain);
|
||||
// EXPECT_EQ(pikaMemNow(), 0);
|
||||
// }
|
||||
#include "gtest/gtest.h"
|
||||
extern "C" {
|
||||
#include "PikaMain.h"
|
||||
#include "PikaStdLib_MemChecker.h"
|
||||
#include "dataArgs.h"
|
||||
#include "dataMemory.h"
|
||||
#include "pikaScript.h"
|
||||
}
|
||||
extern PikaMemInfo pikaMemInfo;
|
||||
TEST(pikaMain, init) {
|
||||
pikaMemInfo.heapUsedMax = 0;
|
||||
PikaObj* pikaMain = pikaScriptInit();
|
||||
obj_deinit(pikaMain);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
||||
|
||||
TEST(pikaMain, new_mem) {
|
||||
pikaMemInfo.heapUsedMax = 0;
|
||||
PikaObj* pikaMain = newRootObj((char*)"pikaMain", New_PikaMain);
|
||||
Parameters* globals =
|
||||
obj_runDirect(pikaMain, (char*)
|
||||
"mem = PikaStdLib.MemChecker()\n"
|
||||
"mem.max()\n"
|
||||
);
|
||||
PikaObj* mem = (PikaObj*)args_getPtr(globals->attributeList, (char*)"mem");
|
||||
PikaObj* memClassPtr = (PikaObj*)obj_getPtr(mem, (char*)"_clsptr");
|
||||
EXPECT_EQ((void*)memClassPtr, (void*)New_PikaStdLib_MemChecker);
|
||||
obj_deinit(pikaMain);
|
||||
obj_deinit(globals);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
@ -335,6 +335,9 @@ Arg* pikaVM_runInstruct(PikaObj* self,
|
||||
}
|
||||
/* get method host obj */
|
||||
PikaObj* methodHostObj = obj_getObj(self, methodPath, 1);
|
||||
if (NULL == methodHostObj) {
|
||||
methodHostObj = obj_getObj(locals, methodPath, 1);
|
||||
}
|
||||
if (NULL == methodHostObj) {
|
||||
/* error, not found object */
|
||||
args_setErrorCode(locals->attributeList, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user