From 89bed1255df1e0a50db8445fb02ff4f58a57bf17 Mon Sep 17 00:00:00 2001 From: yangyang Date: Tue, 11 Apr 2023 21:21:18 +0800 Subject: [PATCH] Add proxy variable to UT testcase Issue:#I6RN4V Signed-off-by: yangyang Change-Id: I2101d31ab19bece062773996aa37d3b30ab52ecd --- tooling/test/testcases/js/variable_second.js | 11 +++++++++++ .../test/testcases/js_variable_second_test.h | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tooling/test/testcases/js/variable_second.js b/tooling/test/testcases/js/variable_second.js index fc16c3a9..c128bd1a 100644 --- a/tooling/test/testcases/js/variable_second.js +++ b/tooling/test/testcases/js/variable_second.js @@ -105,6 +105,17 @@ var o = { var weakMap = new WeakMap(); var weakSet = new WeakSet(); + var proxy0 = new Proxy(obj0, {}); + var proxy1 = new Proxy(map0, {}); + var proxy2 = new Proxy(set0, {}); + var proxy3 = new Proxy(array0, {}); + var proxy4 = new Proxy(dataview0, {}); + var proxy5 = new Proxy(arraybuffer0, {}); + var proxy6 = new Proxy(weakref0, {}); + var proxy7 = new Proxy(sharedarraybuffer0, {}); + var proxy8 = new Proxy(weakMap, {}); + var proxy9 = new Proxy(weakSet, {}); + var nop = undefined; } } diff --git a/tooling/test/testcases/js_variable_second_test.h b/tooling/test/testcases/js_variable_second_test.h index 1f7170b6..7d4beefb 100644 --- a/tooling/test/testcases/js_variable_second_test.h +++ b/tooling/test/testcases/js_variable_second_test.h @@ -36,8 +36,8 @@ public: std::string panfaFile = DEBUGGER_ABC_DIR "variable_second.abc"; std::string sourceFile = DEBUGGER_JS_DIR "variable_second.js"; static_cast(channel_)->Initial(vm_, runtime_); - // 107: breakpointer line - location_ = TestUtil::GetLocation(sourceFile.c_str(), 107, 0, panfaFile.c_str()); + // 118: breakpointer line + location_ = TestUtil::GetLocation(sourceFile.c_str(), 118, 0, panfaFile.c_str()); ASSERT_TRUE(location_.GetMethodId().IsValid()); TestUtil::SuspendUntilContinue(DebugEvent::LOAD_MODULE); ASSERT_EQ(moduleName, panfaFile); @@ -128,7 +128,8 @@ private: auto value = property->GetValue(); std::vector infos; PushValueInfo(value, infos); - if (value->GetType() == RemoteObject::TypeName::Object) { + if (value->GetType() == RemoteObject::TypeName::Object && (!value->HasSubType() || + value->GetSubType() != RemoteObject::SubTypeName::Proxy)) { std::vector> outPropertyDescInner; ASSERT_TRUE(value->HasObjectId()); params.SetObjectId(value->GetObjectId()).SetOwnProperties(true); @@ -370,6 +371,16 @@ private: { "iterator19", { "undefined" } }, { "weakMap", { "object", "weakmap", "Weakmap", "WeakMap", "[object WeakMap]", "none" } }, { "weakSet", { "object", "weakset", "Weakset", "WeakSet", "[object WeakSet]", "none" } }, + { "proxy0", { "object", "proxy", "Object", "Proxy", "[object Object]" }}, + { "proxy1", { "object", "proxy", "Object", "Proxy", "[object Map]" }}, + { "proxy2", { "object", "proxy", "Object", "Proxy", "[object Set]" }}, + { "proxy3", { "object", "proxy", "Object", "Proxy", "Apple,Banana" }}, + { "proxy4", { "object", "proxy", "Object", "Proxy", "[object DataView]" }}, + { "proxy5", { "object", "proxy", "Object", "Proxy", "[object ArrayBuffer]" }}, + { "proxy6", { "object", "proxy", "Object", "Proxy", "[object WeakRef]" }}, + { "proxy7", { "object", "proxy", "Object", "Proxy", "[object SharedArrayBuffer]" }}, + { "proxy8", { "object", "proxy", "Object", "Proxy", "[object WeakMap]" }}, + { "proxy9", { "object", "proxy", "Object", "Proxy", "[object WeakSet]" }}, }; int32_t index_ {0}; -- Gitee