Skip to content

Commit 6770d0b

Browse files
committed
测试
1 parent d7978b1 commit 6770d0b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/papi_qjs_base_test.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,16 @@ TEST_F(PApiBaseTest, ObjectPrivate) {
714714
EXPECT_EQ(&t, p);
715715
}
716716

717+
TEST_F(PApiBaseTest, EvalStrlenPlusOne) {
718+
auto env = apis->get_env_from_ref(env_ref);
719+
720+
auto code = "\n var obj = {}; obj.func();\n ";
721+
// strlen + 1,会导致语法错误
722+
auto ret = apis->eval(env, (const uint8_t*)(code), strlen(code) + 1, "chunk");
723+
ASSERT_TRUE(apis->has_caught(scope));
724+
ASSERT_EQ(0, strncmp("SyntaxError: unexpected token in expression", apis->get_exception_as_string(scope, true), strlen("SyntaxError: unexpected token in expression")));
725+
}
726+
717727
} // namespace qjsimpl
718728
} // namespace pesapi
719729

0 commit comments

Comments
 (0)