Skip to content

Commit

Permalink
多对象创建测试用例
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Feb 26, 2025
1 parent 36d57f2 commit 0486feb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/papi_qjs_base_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,26 @@ TEST_F(PApiBaseTest, ReturnAObject) {
ASSERT_TRUE(apis->get_value_bool(env, ret));
}

TEST_F(PApiBaseTest, MutiObject) {
auto env = apis->get_env_from_ref(env_ref);

auto code = R"(
(function() {
const TestStruct = loadClass('TestStruct');
for (let i = 0; i < 1000; ++i) {
const obj = new TestStruct(123);
const self = obj.GetSelf();
}
})();
)";
auto ret = apis->eval(env, (const uint8_t*)(code), strlen(code), "test.js");
if (apis->has_caught(scope))
{
printf("%s\n", apis->get_exception_as_string(scope, true));
}
ASSERT_FALSE(apis->has_caught(scope));
}

TEST_F(PApiBaseTest, RefArgument) {
auto env = apis->get_env_from_ref(env_ref);

Expand Down

0 comments on commit 0486feb

Please sign in to comment.