Merge branch 'master' into add/iotcloud

This commit is contained in:
dreamcmi 2022-12-17 15:53:12 +08:00
commit 9178ba115e
3 changed files with 41 additions and 1 deletions

View File

@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 11
#define PIKA_VERSION_MICRO 9
#define PIKA_EDIT_TIME "2022/12/11 12:01:10"
#define PIKA_EDIT_TIME "2022/12/17 15:47:06"

View File

@ -2419,6 +2419,27 @@ TEST(vm, issue_not_in) {
EXPECT_EQ(pikaMemNow(), 0);
}
TEST(vm, def_not_in) {
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
obj_run(pikaMain,
"t = ['hmac-md5', 'other']\n"
"def test(a=\"hmac-md5\"):\n"
" print(\"input:\", a)\n"
" print(\"table:\", t)\n"
" if a not in t:\n"
" print(\"a not in t\")\n"
" else:\n"
" print(\"a in t\")\n"
"test()\n");
/* assert */
EXPECT_STREQ(log_buff[0], "a in t\r\n");
/* deinit */
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
#endif
TEST_END

View File

@ -5061,6 +5061,25 @@ TEST(parser, not_in) {
EXPECT_EQ(pikaMemNow(), 0);
}
// TEST(parser, def_not_in) {
// pikaMemInfo.heapUsedMax = 0;
// Args* buffs = New_strBuff();
// char* lines =
// "def test(a=\"hmac-md5\"):\n"
// " print(\"input:\",a)\n"
// " print(\"table:\"t )\n"
// " if a not in t:\n"
// " print(\"a not in t\")else:\n"
// " print(\"a in t\")\n"
// "test()\n";
// printf("%s\r\n", lines);
// char* pikaAsm = Parser_linesToAsm(buffs, lines);
// printf("%s", pikaAsm);
// EXPECT_STREQ(pikaAsm, "");
// args_deinit(buffs);
// EXPECT_EQ(pikaMemNow(), 0);
// }
#endif
TEST_END