From 0486feb15ff21bbd552cbed4c0f9d2eb68228333 Mon Sep 17 00:00:00 2001 From: johnche Date: Wed, 26 Feb 2025 10:10:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E5=AF=B9=E8=B1=A1=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/papi_qjs_base_test.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/papi_qjs_base_test.cpp b/test/papi_qjs_base_test.cpp index b9ddb64..28a9597 100644 --- a/test/papi_qjs_base_test.cpp +++ b/test/papi_qjs_base_test.cpp @@ -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);