From d32e0a9c34e1f0e1dcb7c834b586daa0a7104c87 Mon Sep 17 00:00:00 2001 From: zhouwenxuan Date: Sun, 21 Jan 2024 03:25:43 +0800 Subject: [PATCH] Code duplication rate rectification issue: https://gitee.com/openharmony/arkcompiler_toolchain/issues/I8C8VQ Signed-off-by: zhouwenxuan Change-Id: Id9d3c3511c39cc9669a9493db6cb5a87a1121f34 --- tooling/base/pt_types.h | 2 +- tooling/client/manager/stack_manager.cpp | 13 +- tooling/client/manager/stack_manager.h | 1 - tooling/client/manager/variable_manager.cpp | 12 +- tooling/client/manager/variable_manager.h | 2 - tooling/test/client_utils/test_list.cpp | 4 + tooling/test/client_utils/test_util.cpp | 68 + tooling/test/client_utils/test_util.h | 3 + tooling/test/testcases/js/variable_second.js | 114 +- .../test/testcases/js_module_variable_test.h | 63 +- .../test/testcases/js_variable_first_test.h | 1169 ++++++----------- .../test/testcases/js_variable_second_test.h | 571 +++----- tooling/test/utils/test_list.cpp | 4 - 13 files changed, 710 insertions(+), 1316 deletions(-) diff --git a/tooling/base/pt_types.h b/tooling/base/pt_types.h index 8fb8b40e..6ea9a9ff 100644 --- a/tooling/base/pt_types.h +++ b/tooling/base/pt_types.h @@ -418,7 +418,7 @@ public: return type == Array || type == Null || type == Node || type == Regexp || type == Map || type == Set || type == Weakmap || type == Iterator || type == Generator || type == Error || type == Proxy || type == Promise || type == Typedarray || type == Arraybuffer || type == Dataview || type == I32 || - type == I64 || type == F32 || type == F64 || type == V128 || type == Externref; + type == I64 || type == F32 || type == F64 || type == V128 || type == Externref || type == Weakset; } }; struct ClassName { diff --git a/tooling/client/manager/stack_manager.cpp b/tooling/client/manager/stack_manager.cpp index a9940cb5..0290b2a3 100644 --- a/tooling/client/manager/stack_manager.cpp +++ b/tooling/client/manager/stack_manager.cpp @@ -53,15 +53,4 @@ void StackManager::ClearCallFrame() { callFrames_.clear(); } - -void StackManager::PrintScopeChainInfo(const std::map>& scopeInfos) -{ - for (const auto& [callFrameId, scopes] : scopeInfos) { - std::cout << "CallFrame ID: " << callFrameId << std::endl; - for (const auto& [objectId, type] : scopes) { - std::cout << " Object ID: " << objectId << ", Type: " << type << std::endl; - } - std::cout << "-----------------------" << std::endl; - } -} -} \ No newline at end of file +} // OHOS::ArkCompiler::Toolchain \ No newline at end of file diff --git a/tooling/client/manager/stack_manager.h b/tooling/client/manager/stack_manager.h index 99c65e32..5e240c32 100644 --- a/tooling/client/manager/stack_manager.h +++ b/tooling/client/manager/stack_manager.h @@ -36,7 +36,6 @@ public: void SetCallFrames(std::map> callFrames); void ClearCallFrame(); void ShowCallFrames(); - void PrintScopeChainInfo(const std::map>& scopeInfos); private: [[maybe_unused]] int32_t sessionId_; diff --git a/tooling/client/manager/variable_manager.cpp b/tooling/client/manager/variable_manager.cpp index 38e3b259..cb1ab745 100644 --- a/tooling/client/manager/variable_manager.cpp +++ b/tooling/client/manager/variable_manager.cpp @@ -265,11 +265,6 @@ void VariableManager::ShowHeapUsageInfo() const std::cout << "TotalSize is: " << std::fixed << std::setprecision(0) << heapUsageInfo_.GetTotalSize() << std::endl; } -void VariableManager::ShowVariableInfos() const -{ - variableInfo_.Print(); -} - void VariableManager::ClearVariableInfo() { variableInfo_.Clear(); @@ -307,9 +302,4 @@ int32_t VariableManager::FindObjectIdWithIndex(int index) { return variableInfo_.FindObjectByIndex(index); } - -void VariableManager::Printinfo() const -{ - variableInfo_.PrintRootAndImmediateChildren(); -} -} \ No newline at end of file +} // OHOS::ArkCompiler::Toolchain \ No newline at end of file diff --git a/tooling/client/manager/variable_manager.h b/tooling/client/manager/variable_manager.h index 7bd72b7e..12da4944 100644 --- a/tooling/client/manager/variable_manager.h +++ b/tooling/client/manager/variable_manager.h @@ -77,7 +77,6 @@ public: VariableManager(int32_t sessionId) : sessionId_(sessionId) {} void SetHeapUsageInfo(std::unique_ptr heapUsageReturns); void ShowHeapUsageInfo() const; - void ShowVariableInfos() const; void ClearVariableInfo(); void InitializeTree(std::map> dataMap, int index = 0); void PrintVariableInfo(); @@ -85,7 +84,6 @@ public: int32_t FindObjectIdWithIndex(int index); void AddVariableInfo(TreeNode *parentNode, std::unique_ptr variableInfo); TreeNode* FindNodeObjectZero(); - void Printinfo() const; private: [[maybe_unused]] int32_t sessionId_; diff --git a/tooling/test/client_utils/test_list.cpp b/tooling/test/client_utils/test_list.cpp index 15a1192b..847f72be 100644 --- a/tooling/test/client_utils/test_list.cpp +++ b/tooling/test/client_utils/test_list.cpp @@ -32,6 +32,8 @@ #include "tooling/test/testcases/js_watch_test.h" #include "tooling/test/testcases/js_heapdump_test.h" #include "tooling/test/testcases/js_allocationtrack_test.h" +#include "tooling/test/testcases/js_variable_first_test.h" +#include "tooling/test/testcases/js_variable_second_test.h" namespace panda::ecmascript::tooling::test { static std::string g_currentTestName = ""; @@ -53,6 +55,8 @@ static void RegisterTests() TestUtil::RegisterTest("JsWatchTest", GetJsWatchTest()); TestUtil::RegisterTest("JsHeapdumpTest", GetJsHeapdumpTest()); TestUtil::RegisterTest("JsAllocationtrackTest", GetJsAllocationtrackTest()); + TestUtil::RegisterTest("JsVariableFirstTest", GetJsVariableFirstTest()); + TestUtil::RegisterTest("JsVariableSecondTest", GetJsVariableSecondTest()); } std::vector GetTestList() diff --git a/tooling/test/client_utils/test_util.cpp b/tooling/test/client_utils/test_util.cpp index 2efe46cf..97e044d4 100644 --- a/tooling/test/client_utils/test_util.cpp +++ b/tooling/test/client_utils/test_util.cpp @@ -226,4 +226,72 @@ void TestUtil::SendMessage(ActionInfo action, std::string recv) } return; } + +void TestUtil::PushValueInfo(RemoteObject *value, std::vector &infos) +{ + std::cout << "type: " << value->GetType() << std::endl; + infos.push_back(value->GetType()); + if (value->HasSubType()) { + std::cout << "sub type: " << value->GetSubType() << std::endl; + infos.push_back(value->GetSubType()); + } + if (value->HasClassName()) { + std::cout << "class name: " << value->GetClassName() << std::endl; + infos.push_back(value->GetClassName()); + } + if (value->HasUnserializableValue()) { + std::cout << "unserializableValue: " << value->GetUnserializableValue() << std::endl; + infos.push_back(value->GetUnserializableValue()); + } + if (value->HasDescription()) { + std::cout << "desc: " << value->GetDescription() << std::endl; + infos.push_back(value->GetDescription()); + } +} + +bool TestUtil::ComparePropertyDescriptors(const std::unique_ptr& innerResult, + const std::map>& variableMap) +{ + std::map> outPropertyDescs; + std::vector attributes; + + for (int32_t i = 0; i < innerResult->GetSize(); i++) { + auto info = PropertyDescriptor::Create(*(innerResult->Get(i))); + std::string name = info->GetName(); + auto value = info->GetValue(); + std::cout << " ============================ " << std::endl; + std::cout << "variableName is: " << name << std::endl; + attributes.clear(); + TestUtil::PushValueInfo(value, attributes); + outPropertyDescs[name] = attributes; + } + + // compare size + if (outPropertyDescs.size() != variableMap.size()) { + std::cout << "outPropertyDescs.size() != variableMap.size()" << std::endl; + std::cout << "outPropertyDescs.size() is: " << outPropertyDescs.size() << std::endl; + std::cout << "variableMap.size() is: " << variableMap.size() << std::endl; + return false; + } + + // compare the properties of each variable + for (const auto &outPropertyDesc : outPropertyDescs) { + const std::string &variableName = outPropertyDesc.first; + const std::vector &actualAttributes = outPropertyDesc.second; + + if (variableMap.find(variableName) != variableMap.end()) { + const std::vector &expectedAttributes = variableMap.at(variableName); + if (actualAttributes == expectedAttributes) { + continue; + } else { + std::cout << "Property mismatch: " << variableName << std::endl; + return false; + } + } else { + std::cout << "variable name not found: " << variableName << std::endl; + return false; + } + } + return true; +} } // namespace panda::ecmascript::tooling::test diff --git a/tooling/test/client_utils/test_util.h b/tooling/test/client_utils/test_util.h index 673d76a5..27a1131d 100644 --- a/tooling/test/client_utils/test_util.h +++ b/tooling/test/client_utils/test_util.h @@ -65,6 +65,9 @@ public: static void ForkSocketClient(int port, const std::string &name); static void HandleAcceptanceMessages(ActionInfo action, WebSocketClient &client, std::string &recv, bool &success); static void SendMessage(ActionInfo action, std::string recv); + static void PushValueInfo(RemoteObject *value, std::vector &infos); + static bool ComparePropertyDescriptors(const std::unique_ptr& innerResult, + const std::map>& variableMap); private: static void NotifyFail(); diff --git a/tooling/test/testcases/js/variable_second.js b/tooling/test/testcases/js/variable_second.js index ab933922..9bf328cd 100644 --- a/tooling/test/testcases/js/variable_second.js +++ b/tooling/test/testcases/js/variable_second.js @@ -14,37 +14,37 @@ */ var o = { - "foo" : function() { - var number0 = 1; - var string0 = "helloworld"; - var boolean0 = new Boolean(0); - var obj0 = { - "key0": "value0", - "key1": 100 + "foo123" : function() { + var number123 = 1; + var string123 = "helloworld"; + var boolean123 = new Boolean(0); + var obj123 = { + "key10": "value10", + "key1": 10 }; - function function0() { - var test = 0; + function function123() { + var test = 10; } - var map0 = new Map(); - var set0 = new Set(); - var undefined0 = undefined; - let array0 = ['Apple', 'Banana'] - function* generator0() { - let aa = 0; - var a1 = 100; - yield 1; - yield 2; - yield 3; + var map123 = new Map(); + var set123 = new Set(); + var undefined123 = undefined; + let array123 = ['Apple', 'Banana'] + function* generator123() { + let aa = 10; + var a1 = 20; + yield 4; + yield 5; + yield 6; } - var regexp0 = /^\d+\.\d+$/i; - var arraybuffer0 = new ArrayBuffer(24); - var uint8array0 = new Uint8Array(arraybuffer0); - const dataview0 = new DataView(arraybuffer0, 0); - var bigint0 = BigInt(999n); - var typedarray0 = new Uint8Array(); - var sharedarraybuffer0 = new SharedArrayBuffer(32); - var iterator0 = string0[Symbol.iterator]; - var weakref0 = new WeakRef(obj0); + var regexp123 = /^\d+\.\d+$/i; + var arraybuffer123 = new ArrayBuffer(24); + var uint8array123 = new Uint8Array(arraybuffer123); + const dataview123 = new DataView(arraybuffer123, 0); + var bigint123 = BigInt(999n); + var typedarray123 = new Uint8Array(); + var sharedarraybuffer123 = new SharedArrayBuffer(32); + var iterator123 = string123[Symbol.iterator]; + var weakref123 = new WeakRef(obj123); var array1 = []; array1.push('banana', 'apple', 'peach'); @@ -53,21 +53,21 @@ var o = { var array3 = ['banana', 'apple', 'peach']; array3.pop(); var array4 = array3.shift(); - var array5 = new Array(number0); - var array6 = new Array(string0); - var array7 = new Array(boolean0); - var array8 = new Array(obj0); - var array9 = new Array(function0); - var array10 = new Array(map0); - var array11 = new Array(set0); - var array12 = new Array(undefined0); - var array13 = new Array(array0); - var array14 = new Array(generator0); - var array15 = new Array(regexp0); - var array16 = new Array(arraybuffer0); - var array17 = new Array(uint8array0); - var array18 = new Array(dataview0); - var array19 = new Array(bigint0); + var array5 = new Array(number123); + var array6 = new Array(string123); + var array7 = new Array(boolean123); + var array8 = new Array(obj123); + var array9 = new Array(function123); + var array10 = new Array(map123); + var array11 = new Array(set123); + var array12 = new Array(undefined123); + var array13 = new Array(array123); + var array14 = new Array(generator123); + var array15 = new Array(regexp123); + var array16 = new Array(arraybuffer123); + var array17 = new Array(uint8array123); + var array18 = new Array(dataview123); + var array19 = new Array(bigint123); var array20 = array1; var array21 = array4; @@ -81,14 +81,14 @@ var o = { var typedarray8 = new Float64Array(); var typedarray9 = new BigInt64Array(); var typedarray10 = new BigUint64Array(); - var typedarray11 = new Uint8Array(number0); + var typedarray11 = new Uint8Array(number123); - var iterator1 = array0[Symbol.iterator]; - var iterator2 = map0[Symbol.iterator]; - var iterator3 = set0[Symbol.iterator]; - var iterator4 = uint8array0[Symbol.iterator]; - var iterator5 = iterator0; - var iterator6 = typedarray0[Symbol.iterator]; + var iterator1 = array123[Symbol.iterator]; + var iterator2 = map123[Symbol.iterator]; + var iterator3 = set123[Symbol.iterator]; + var iterator4 = uint8array123[Symbol.iterator]; + var iterator5 = iterator123; + var iterator6 = typedarray123[Symbol.iterator]; var iterator7 = typedarray1[Symbol.iterator]; var iterator8 = typedarray2[Symbol.iterator]; var iterator9 = typedarray3[Symbol.iterator]; @@ -99,32 +99,32 @@ var o = { var iterator14 = typedarray8[Symbol.iterator]; var iterator15 = typedarray9[Symbol.iterator]; var iterator16 = typedarray10[Symbol.iterator]; - var iterator17 = obj0[Symbol.iterator]; - var iterator19 = sharedarraybuffer0[Symbol.iterator]; + var iterator17 = obj123[Symbol.iterator]; + var iterator19 = sharedarraybuffer123[Symbol.iterator]; - var weakMap0 = new WeakMap(); + var weakmap123 = new WeakMap(); var p1 = new Number(1); var p2 = new Number(2); var weakMap1 = new WeakMap([[p1, 'hello'], [p2, 'world']]); var weakMap2 = new WeakMap(); weakMap2[0] = 'hello'; var weakMap3 = new WeakMap(); - weakMap3.set(weakMap0, "weakMap0"); + weakMap3.set(weakmap123, "weakmap123"); var weakMap4 = new WeakMap(); weakMap4.set(p1, 37); weakMap4.set(p2, 'azerty'); var weakMap5 = new WeakMap(); weakMap5.set(p1, undefined); - var weakSet0 = new WeakSet(); + var weakset123 = new WeakSet(); var weakSet1 = new WeakSet(); weakSet1.add(p1); var weakSet2 = new WeakSet(); weakSet2.add(p2); weakSet2.add(weakSet1); - var nop = undefined; + var nop123 = undefined; } } -o.foo() \ No newline at end of file +o.foo123() \ No newline at end of file diff --git a/tooling/test/testcases/js_module_variable_test.h b/tooling/test/testcases/js_module_variable_test.h index 2ee3bee1..52f234bc 100644 --- a/tooling/test/testcases/js_module_variable_test.h +++ b/tooling/test/testcases/js_module_variable_test.h @@ -135,49 +135,10 @@ public: return false; } - std::vector> outPropertyDesc; - for (int32_t i = 0; i < innerResult->GetSize(); i++) { - auto variableInfo = PropertyDescriptor::Create(*(innerResult->Get(i))); - outPropertyDesc.emplace_back(std::move(variableInfo)); - } - - std::map> actualProperties; - for (const auto &property : outPropertyDesc) { - std::vector attributes; - RemoteObject *value = property->GetValue(); - std::cout << " ============================== " << std::endl; - std::cout << "variableName: " << property->GetName() << std::endl; - PushValueInfo(value, attributes); - actualProperties[property->GetName()] = attributes; - } - - // compare size - if (actualProperties.size() != moduleVariableMap_.size()) { - std::cout << "actualProperties.size() != moduleVariableMap_.size()" << std::endl; - std::cout << "actualProperties.size() is: " << actualProperties.size() << std::endl; - std::cout << "moduleVariableMap_.size() is: " << moduleVariableMap_.size() << std::endl; + if (!TestUtil::ComparePropertyDescriptors(innerResult, moduleVariableMap_)) { return false; } - // compare the properties of each variable - for (const auto &actualProperty : actualProperties) { - const std::string &variableName = actualProperty.first; - const std::vector &actualAttributes = actualProperty.second; - - if (moduleVariableMap_.find(variableName) != moduleVariableMap_.end()) { - const std::vector &expectedAttributes = moduleVariableMap_.at(variableName); - if (actualAttributes == expectedAttributes) { - continue; - } else { - std::cout << "Property mismatch: " << variableName << std::endl; - return false; - } - } else { - std::cout << "variable name not found: " << variableName << std::endl; - return false; - } - } - RuntimeClient runtimeClient(0); runtimeClient.HandleGetProperties(std::move(json), id); return true; @@ -288,28 +249,6 @@ private: std::string entryPoint_ = "module_variable"; size_t expectDesIndex = 0; - void PushValueInfo(RemoteObject *value, std::vector &infos) - { - std::cout << "type: " << value->GetType() << std::endl; - infos.push_back(value->GetType()); - if (value->HasSubType()) { - std::cout << "sub type: " << value->GetSubType() << std::endl; - infos.push_back(value->GetSubType()); - } - if (value->HasClassName()) { - std::cout << "class name: " << value->GetClassName() << std::endl; - infos.push_back(value->GetClassName()); - } - if (value->HasUnserializableValue()) { - std::cout << "unserializableValue: " << value->GetUnserializableValue() << std::endl; - infos.push_back(value->GetUnserializableValue()); - } - if (value->HasDescription()) { - std::cout << "desc: " << value->GetDescription() << std::endl; - infos.push_back(value->GetDescription()); - } - } - bool CompareExpected(std::string recv, const std::string &expect) { expectDesIndex++; diff --git a/tooling/test/testcases/js_variable_first_test.h b/tooling/test/testcases/js_variable_first_test.h index 406f8d58..19d11c64 100644 --- a/tooling/test/testcases/js_variable_first_test.h +++ b/tooling/test/testcases/js_variable_first_test.h @@ -13,825 +13,404 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_TOOLING_TEST_UTILS_TESTCASES_JS_VARIABLE_TEST_H -#define ECMASCRIPT_TOOLING_TEST_UTILS_TESTCASES_JS_VARIABLE_TEST_H +#ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_VARIABLE_FIRST_TEST_H +#define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_VARIABLE_FIRST_TEST_H -#include "test/utils/test_util.h" +#include "tooling/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { -class JsVariableFirstTest : public TestEvents { +class JsVariableFirstTest : public TestActions { public: JsVariableFirstTest() { - breakpoint = [this](const JSPtLocation &location) { - ASSERT_TRUE(location.GetMethodId().IsValid()); - ASSERT_LOCATION_EQ(location, location_); - ++breakpointCounter_; - debugger_->NotifyPaused(location, PauseReason::INSTRUMENTATION); - TestUtil::SuspendUntilContinue(DebugEvent::BREAKPOINT, location); - return true; - }; - - loadModule = [this](std::string_view moduleName) { - std::string pandaFile = DEBUGGER_ABC_DIR "variable_first.abc"; - std::string sourceFile = DEBUGGER_JS_DIR "variable_first.js"; - static_cast(channel_)->Initial(vm_, runtime_); - runtime_->Enable(); - // 306: breakpointer line - int32_t lineNumber = 306; - location_ = TestUtil::GetLocation(sourceFile.c_str(), lineNumber, 0, pandaFile.c_str()); - ASSERT_TRUE(location_.GetMethodId().IsValid()); - TestUtil::SuspendUntilContinue(DebugEvent::LOAD_MODULE); - ASSERT_EQ(moduleName, pandaFile); - ASSERT_TRUE(debugger_->NotifyScriptParsed(0, pandaFile)); - auto condFuncRef = FunctionRef::Undefined(vm_); - auto ret = debugInterface_->SetBreakpoint(location_, condFuncRef); - ASSERT_TRUE(ret); - return true; - }; - - scenario = [this]() { - TestUtil::WaitForLoadModule(); - TestUtil::Continue(); - TestUtil::WaitForBreakpoint(location_); - TestUtil::Continue(); - auto ret = debugInterface_->RemoveBreakpoint(location_); - ASSERT_TRUE(ret); - ASSERT_EXITED(); - return true; - }; - - vmDeath = [this]() { - ASSERT_EQ(breakpointCounter_, 1U); // 1: break point counter - return true; - }; - - channel_ = new JsVariableFirstTestChannel(); - } + testAction = { + {SocketAction::SEND, "enable"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + {SocketAction::SEND, "runtime-enable"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + {SocketAction::SEND, "run"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + // load variable_first.js + {SocketAction::RECV, "Debugger.scriptParsed", ActionRule::STRING_CONTAIN}, + // break on start + {SocketAction::RECV, "Debugger.paused", ActionRule::STRING_CONTAIN}, + // set breakpoint + {SocketAction::SEND, "b " DEBUGGER_JS_DIR "variable_first.js 291"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + {SocketAction::SEND, "resume"}, + {SocketAction::RECV, "Debugger.resumed", ActionRule::STRING_CONTAIN}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, [this] (auto recv, auto, auto) -> bool { + std::unique_ptr json = PtJson::Parse(recv); + Result ret; + std::string method; + ret = json->GetString("method", &method); + if (ret != Result::SUCCESS || method != "Debugger.paused") { + return false; + } + std::unique_ptr params = nullptr; + ret = json->GetObject("params", ¶ms); + if (ret != Result::SUCCESS) { + return false; + } + std::unique_ptr hitBreakpoints = nullptr; + ret = params->GetArray("hitBreakpoints", &hitBreakpoints); + if (ret != Result::SUCCESS) { + return false; + } - std::pair GetEntryPoint() override - { - std::string pandaFile = DEBUGGER_ABC_DIR "variable_first.abc"; - return {pandaFile, entryPoint_}; - } - ~JsVariableFirstTest() - { - delete channel_; - channel_ = nullptr; - } + std::string breakpoint; + breakpoint = hitBreakpoints->Get(0)->GetString(); + if (ret != Result::SUCCESS || breakpoint.find(sourceFile_) == std::string::npos || + breakpoint.find("290") == std::string::npos) { + return false; + } -private: - class JsVariableFirstTestChannel : public TestChannel { - public: - JsVariableFirstTestChannel() = default; - ~JsVariableFirstTestChannel() = default; - void Initial(const EcmaVM *vm, RuntimeImpl *runtime) - { - vm_ = vm; - runtime_ = runtime; - } + DebuggerClient debuggerClient(0); + debuggerClient.PausedReply(std::move(json)); + return true; + }}, - void SendNotification(const PtBaseEvents &events) override - { - const static std::vector> eventList = { - [](const PtBaseEvents &events) -> bool { - std::string sourceFile = DEBUGGER_JS_DIR "variable_first.js"; - auto parsed = static_cast(&events); - std::string str = parsed->ToJson()->Stringify(); - std::cout << "JsVariableFirstTestChannel: SendNotification 0:\n" << str << std::endl; + {SocketAction::SEND, "p"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, [this] (auto recv, auto, auto) -> bool { + std::unique_ptr json = PtJson::Parse(recv); - ASSERT_EQ(parsed->GetName(), "Debugger.scriptParsed"); - ASSERT_EQ(parsed->GetUrl(), sourceFile); - return true; - }, - [this](const PtBaseEvents &events) -> bool { - auto paused = static_cast(&events); - std::string str = paused->ToJson()->Stringify(); - std::cout << "JsVariableFirstTestChannel: SendNotification 1:\n" << str << std::endl; + int id; + Result ret = json->GetInt("id", &id); + if (ret != Result::SUCCESS) { + return false; + } - ASSERT_EQ(paused->GetName(), "Debugger.paused"); - auto frame = paused->GetCallFrames()->at(0).get(); - ASSERT_EQ(frame->GetFunctionName(), "resolveHandler"); - auto scopes = frame->GetScopeChain(); - ASSERT_EQ(scopes->size(), 3U); // 2: contain local, global and closure - for (uint32_t i = 0; i < scopes->size(); i++) { - auto scope = scopes->at(i).get(); - if (scope->GetType() != Scope::Type::Local()) { - continue; - } - auto localId = scope->GetObject()->GetObjectId(); - GetPropertiesParams params; - params.SetObjectId(localId).SetOwnProperties(true); - std::vector> outPropertyDesc; - runtime_->GetProperties(params, &outPropertyDesc, {}, {}, {}); - for (const auto &property : outPropertyDesc) { - std::cout << "=====================================" << std::endl; - std::cout << property->GetName() << std::endl; - auto value = property->GetValue(); - std::vector infos; - PushValueInfo(value, infos); - if (value->GetType() == RemoteObject::TypeName::Object) { - std::vector> outPropertyDescInner; - ASSERT_TRUE(value->HasObjectId()); - params.SetObjectId(value->GetObjectId()).SetOwnProperties(true); - runtime_->GetProperties(params, &outPropertyDescInner, {}, {}, {}); - if (outPropertyDescInner.size() == 0) { - infos.push_back("none"); - } - for (const auto &propertyInner : outPropertyDescInner) { - std::cout << "###########################################" << std::endl; - std::cout << propertyInner->GetName() << std::endl; - infos.push_back(propertyInner->GetName()); - auto innerValue = propertyInner->GetValue(); - PushValueInfo(innerValue, infos); - } - } - ASSERT_EQ(infos.size(), variableMap_.at(property->GetName()).size()); - for (uint32_t j = 0; j < infos.size(); j++) { - ASSERT_EQ(infos[j], variableMap_.at(property->GetName())[j]); - } - } - } - return true; + std::unique_ptr result; + ret = json->GetObject("result", &result); + if (ret != Result::SUCCESS) { + return false; } - }; - ASSERT_TRUE(eventList[index_](events)); - index_++; - } + std::unique_ptr innerResult; + ret = result->GetArray("result", &innerResult); + if (ret != Result::SUCCESS) { + return false; + } - private: - NO_COPY_SEMANTIC(JsVariableFirstTestChannel); - NO_MOVE_SEMANTIC(JsVariableFirstTestChannel); + if (!TestUtil::ComparePropertyDescriptors(innerResult, variableMap_)) { + return false; + } - void PushValueInfo(RemoteObject *value, std::vector &infos) - { - std::cout << "type: " << value->GetType() << std::endl; - infos.push_back(value->GetType()); - if (value->HasObjectId()) { - std::cout << "id: " << value->GetObjectId() << std::endl; - } - if (value->HasSubType()) { - std::cout << "sub type: " << value->GetSubType() << std::endl; - infos.push_back(value->GetSubType()); - } - if (value->HasClassName()) { - std::cout << "class name: " << value->GetClassName() << std::endl; - infos.push_back(value->GetClassName()); - } - if (value->HasDescription()) { - std::cout << "desc: " << value->GetDescription() << std::endl; - infos.push_back(value->GetDescription()); - } - if (value->HasValue()) { - std::cout << "type: " << - value->GetValue()->Typeof(vm_)->ToString() << std::endl; - std::cout << "tostring: " << - value->GetValue()->ToString(vm_)->ToString() << std::endl; - infos.push_back(value->GetValue()->ToString(vm_)->ToString()); - } - } + RuntimeClient runtimeClient(0); + runtimeClient.HandleGetProperties(std::move(json), id); + return true; + }}, - /* - * Expect map type: map - * value list (optional): - * type - * subType - * className - * description - * value tostring - * - * if is object value, will push back key and value. - * - * for example: - * var abc = 1 - * { "abc", { "number", "1", "1" } } - * var obj = { "key": "2" } - * { "obj0", { "object", "Object", "Object", "[object Object]", "key", "string", "2", "2" } } - */ - const std::map> variableMap_ = { - { "nop", { "undefined" } }, - { "foo", { "function", "Function", "function foo( { [js code] }", - "Cannot get source code of funtion"} }, - { "string0", { "string", "helloworld", "helloworld" } }, - { "boolean0", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "number0", { "number", "1", "1" } }, - { "obj0", { "object", "Object", "Object", "[object Object]", - "key0", "string", "value0", "value0", - "key1", "number", "100", "100" } }, - { "arraybuffer0", { "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "[object ArrayBuffer]", - "[[Int8Array]]", "object", "Object", "Int8Array(24)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint8Array]]", "object", - "Object", "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Uint8ClampedArray]]", "object", "Object", "Object", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Int16Array]]", "object", - "Object", "Int16Array(12)", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint16Array]]", "object", - "Object", "Object", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", - "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Object", - "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Object", "0,0,0,0,0,0", - "[[Float64Array]]", "object", "Object", "Object", "0,0,0", "[[BigInt64Array]]", - "object", "Object", "Object", "0,0,0", "[[BigUint64Array]]", "object", "Object", - "Object", "0,0,0" } }, - { "function0", { "function", "Function", "function function0( { [js code] }", - "Cannot get source code of funtion" } }, - { "generator0", { "function", "Generator", "function* generator0( { [js code] }", - "Cannot get source code of funtion" } }, - { "map0", { "object", "map", "Map", "Map(0)", "[object Map]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "set0", { "object", "set", "Set", "Set(0)", "[object Set]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "undefined0", { "undefined" } }, - { "array0", { "object", "array", "Array", "Array(2)", "Apple,Banana", "0", "string", "Apple", "Apple", - "1", "string", "Banana", "Banana", "length", "number", "2", "2" } }, - { "regexp0", { "object", "regexp", "RegExp", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i", "global", "boolean", - "false", "false", "ignoreCase", "boolean", "true", "true", "multiline", "boolean", "false", - "false", "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", - "unicode", "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", - "string", "i", "i", "source", "string", "^\\d+\\.\\d+$", "^\\d+\\.\\d+$", "lastIndex", - "number", "0", "0" } }, - { "uint8array0", { "object", "Object", "Uint8Array(24)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "0", "number", "0", "0", - "1", "number", "0", "0", "2", "number", "0", "0", "3", "number", "0", "0", "4", - "number", "0", "0", "5", "number", "0", "0", "6", "number", "0", "0", "7", - "number", "0", "0", "8", "number", "0", "0", "9", "number", "0", "0", "10", - "number", "0", "0", "11", "number", "0", "0", "12", "number", "0", "0", "13", - "number", "0", "0", "14", "number", "0", "0", "15", "number", "0", "0", "16", - "number", "0", "0", "17", "number", "0", "0", "18", "number", "0", "0", "19", - "number", "0", "0", "20", "number", "0", "0", "21", "number", "0", "0", "22", - "number", "0", "0", "23", "number", "0", "0" } }, - { "dataview0", { "object", "dataview", "Dataview", "DataView(24)", "[object DataView]", "buffer", - "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "[object ArrayBuffer]", - "byteLength", "number", "24", "24", "byteOffset", "number", "0", "0" } }, - { "bigint0", { "bigint", "999n", "999" } }, - { "typedarray0", { "object", "Object", "Uint8Array(0)", "", "none" } }, - { "sharedarraybuffer0", { "object", "Object", "SharedArrayBuffer(32)", "[object SharedArrayBuffer]", - "[[Int8Array]]", "object", "Object", "Int8Array(32)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Uint8Array]]", "object", "Object", "Uint8Array(32)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Int16Array]]", "object", "Object", "Int16Array(16)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", - "Int32Array(8)", "0,0,0,0,0,0,0,0", "[[ArrayBufferByteLength]]", "number", "32", - "32", "byteLength", "number", "32", "32" } }, - { "weakref0", { "object", "Object", "WeakRef {}", "[object WeakRef]", "none" } }, - { "iterator0", { "function", "Function", "function [Symbol.iterator]( { [native code] }", - "function [Symbol.iterator]() { [native code] }" } }, - { "set1", { "object", "set", "Set", "Set(1) {1}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "1" } }, - { "set2", { "object", "set", "Set", "Set(7) {'h', 'e', 'l', 'o', 'w', ...}", "[object Set]", "size", - "number", "7", "7", "[[Entries]]", "object", "array", "Array", "Array(7)", - "h,e,l,o,w,r,d" } }, - { "set3", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set4", { "object", "set", "Set", "Set(0)", "[object Set]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "set5", { "object", "set", "Set", "Set(2) {'Apple', 'Banana'}", "[object Set]", "size", "number", "2", - "2", "[[Entries]]", "object", "array", "Array", "Array(2)", "Apple,Banana" } }, - { "set6", { "object", "set", "Set", "Set(0)", "[object Set]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "set7", { "object", "set", "Set", "Set(0)", "[object Set]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "set8", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set9", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set10", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set11", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set12", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set13", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set14", { "object", "set", "Set", "Set(0)", "[object Set]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "set15", { "object", "set", "Set", "Set(4) {0, 'hello', Object, 1}", "[object Set]", "size", - "number", "4", "4", "[[Entries]]", "object", "array", "Array", "Array(4)", - "0,hello,[object Object],1" } }, - { "set16", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set17", { "object", "set", "Set", "Set(1) {999}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "999" } }, - { "set18", { "object", "set", "Set", "Set(1) {Object}", "[object Set]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "set19", { "object", "set", "Set", "Set(0)", "[object Set]", "size", "number", "0", "0", - "[[Entries]]", "object", "array", "Array", "Array(0)", "" } }, - { "number1", { "number", "65535", "65535" } }, - { "number2", { "number", "5e-324", "5e-324" } }, - { "number3", { "number", "10000000000", "10000000000" } }, - { "number4", { "number", "2199023255551", "2199023255551" } }, - { "number5", { "number", "16383", "16383" } }, - { "number6", { "object", "Object", "Number{[[PrimitiveValue]]: 999}", "999", "[[PrimitiveValue]]", - "number", "999", "999" } }, - { "number7", { "number", "1.23e+47", "1.23e+47" } }, - { "number8", { "number", "1", "1" } }, - { "number9", { "number", "65536", "65536" } }, - { "number10", { "number", "-65534", "-65534" } }, - { "number11", { "number", "65535", "65535" } }, - { "number12", { "number", "0.000015259021896696422", "0.000015259021896696422" } }, - { "number13", { "number", "1", "1" } }, - { "number14", { "object", "Object", "Number{[[PrimitiveValue]]: 0}", "0", "[[PrimitiveValue]]", "number", - "0", "0" } }, - { "number15", { "object", "Object", "Number{[[PrimitiveValue]]: 1.7976931348623157e+308}", - "1.7976931348623157e+308", "[[PrimitiveValue]]", "number", "1.7976931348623157e+308", - "1.7976931348623157e+308" } }, - { "number16", { "object", "Object", "Number{[[PrimitiveValue]]: 5e-324}", "5e-324", "[[PrimitiveValue]]", - "number", "5e-324", "5e-324" } }, - { "number17", { "object", "Object", "Number{[[PrimitiveValue]]: 10000000000}", "10000000000", - "[[PrimitiveValue]]", "number", "10000000000", "10000000000" } }, - { "number18", { "object", "Object", "Number{[[PrimitiveValue]]: 2199023255551}", "2199023255551", - "[[PrimitiveValue]]", "number", "2199023255551", "2199023255551" } }, - { "number19", { "object", "Object", "Number{[[PrimitiveValue]]: 16383}", "16383", "[[PrimitiveValue]]", - "number", "16383", "16383" } }, - { "number20", { "object", "Object", "Number{[[PrimitiveValue]]: 1.23e+47}", "1.23e+47", - "[[PrimitiveValue]]", "number", "1.23e+47", "1.23e+47" } }, - { "number21", { "object", "Object", "Number{[[PrimitiveValue]]: 1}", "1", "[[PrimitiveValue]]", "number", - "1", "1" } }, - { "number22", { "object", "Object", "Number{[[PrimitiveValue]]: 65536}", "65536", "[[PrimitiveValue]]", - "number", "65536", "65536" } }, - { "number23", { "object", "Object", "Number{[[PrimitiveValue]]: -65534}", "-65534", "[[PrimitiveValue]]", - "number", "-65534", "-65534" } }, - { "number24", { "object", "Object", "Number{[[PrimitiveValue]]: 65535}", "65535", "[[PrimitiveValue]]", - "number", "65535", "65535" } }, - { "number25", { "object", "Object", "Number{[[PrimitiveValue]]: 0.000015259021896696422}", - "0.000015259021896696422", "[[PrimitiveValue]]", "number", "0.000015259021896696422", - "0.000015259021896696422" } }, - { "number26", { "object", "Object", "Number{[[PrimitiveValue]]: 1}", "1", "[[PrimitiveValue]]", "number", - "1", "1" } }, - { "number27", { "number", "1.7976931348623157e+308", "1.7976931348623157e+308" } }, - { "string1", { "string", "", "" } }, - { "string2", { "string", "", "" } }, - { "string3", { "string", "world", "world" } }, - { "string4", { "string", "helloworld", "helloworld" } }, - { "string5", { "string", "e", "e" } }, - { "string6", { "string", "1", "1" } }, - { "string7", { "object", "Object", "String{[[PrimitiveValue]]: }", "", "[[PrimitiveValue]]", "string", "", - "", "length", "number", "0", "0" } }, - { "string8", { "object", "Object", "String{[[PrimitiveValue]]: [object Set]}", "[object Set]", - "[[PrimitiveValue]]", "string", "[object Set]", "[object Set]", "0", "string", "[", "[", - "1", "string", "o", "o", "2", "string", "b", "b", "3", "string", "j", "j", "4", "string", - "e", "e", "5", "string", "c", "c", "6", "string", "t", "t", "7", "string", " ", " ", "8", - "string", "S", "S", "9", "string", "e", "e", "10", "string", "t", "t", "11", "string", "]", - "]", "length", "number", "12", "12" } }, - { "string9", { "object", "Object", "String{[[PrimitiveValue]]: 1}", "1", "[[PrimitiveValue]]", "string", - "1", "1", "0", "string", "1", "1", "length", "number", "1", "1" } }, - { "string10", { "object", "Object", "String{[[PrimitiveValue]]: helloworld}", "helloworld", - "[[PrimitiveValue]]", "string", "helloworld", "helloworld", "0", "string", "h", "h", "1", - "string", "e", "e", "2", "string", "l", "l", "3", "string", "l", "l", "4", "string", "o", - "o", "5", "string", "w", "w", "6", "string", "o", "o", "7", "string", "r", "r", "8", - "string", "l", "l", "9", "string", "d", "d", "length", "number", "10", "10" } }, - { "string11", { "object", "Object", "String{[[PrimitiveValue]]: [object Object]}", "[object Object]", - "[[PrimitiveValue]]", "string", "[object Object]", "[object Object]", "0", "string", "[", - "[", "1", "string", "o", "o", "2", "string", "b", "b", "3", "string", "j", "j", "4", - "string", "e", "e", "5", "string", "c", "c", "6", "string", "t", "t", "7", "string", " ", - " ", "8", "string", "O", "O", "9", "string", "b", "b", "10", "string", "j", "j", "11", - "string", "e", "e", "12", "string", "c", "c", "13", "string", "t", "t", "14", "string", - "]", "]", "length", "number", "15", "15" } }, - { "string12", { "object", "Object", "String{[[PrimitiveValue]]: undefined}", "undefined", - "[[PrimitiveValue]]", "string", "undefined", "undefined", "0", "string", "u", "u", "1", - "string", "n", "n", "2", "string", "d", "d", "3", "string", "e", "e", "4", "string", "f", - "f", "5", "string", "i", "i", "6", "string", "n", "n", "7", "string", "e", "e", "8", - "string", "d", "d", "length", "number", "9", "9" } }, - { "string13", { "object", "Object", "String{[[PrimitiveValue]]: Apple,Banana}", "Apple,Banana", - "[[PrimitiveValue]]", "string", "Apple,Banana", "Apple,Banana", "0", "string", "A", "A", - "1", "string", "p", "p", "2", "string", "p", "p", "3", "string", "l", "l", "4", "string", - "e", "e", "5", "string", ",", ",", "6", "string", "B", "B", "7", "string", "a", "a", "8", - "string", "n", "n", "9", "string", "a", "a", "10", "string", "n", "n", "11", "string", - "a", "a", "length", "number", "12", "12" } }, - { "string14", { "object", "Object", "String{[[PrimitiveValue]]: 999}", "999", "[[PrimitiveValue]]", - "string", "999", "999", "0", "string", "9", "9", "1", "string", "9", "9", "2", "string", - "9", "9", "length", "number", "3", "3" } }, - { "string15", { "object", "Object", "String{[[PrimitiveValue]]: Cannot get source code of funtion}", - "Cannot get source code of funtion", "[[PrimitiveValue]]", "string", - "Cannot get source code of funtion", "Cannot get source code of funtion", "0", "string", - "C", "C", "1", "string", "a", "a", "2", "string", "n", "n", "3", "string", "n", "n", "4", - "string", "o", "o", "5", "string", "t", "t", "6", "string", " ", " ", "7", "string", "g", - "g", "8", "string", "e", "e", "9", "string", "t", "t", "10", "string", " ", " ", "11", - "string", "s", "s", "12", "string", "o", "o", "13", "string", "u", "u", "14", "string", - "r", "r", "15", "string", "c", "c", "16", "string", "e", "e", "17", "string", " ", " ", - "18", "string", "c", "c", "19", "string", "o", "o", "20", "string", "d", "d", "21", - "string", "e", "e", "22", "string", " ", " ", "23", "string", "o", "o", "24", "string", - "f", "f", "25", "string", " ", " ", "26", "string", "f", "f", "27", "string", "u", "u", - "28", "string", "n", "n", "29", "string", "t", "t", "30", "string", "i", "i", "31", - "string", "o", "o", "32", "string", "n", "n", "length", "number", "33", "33" } }, - { "string16", { "object", "Object", "String{[[PrimitiveValue]]: /^\\d+\\.\\d+$/i}", "/^\\d+\\.\\d+$/i", - "[[PrimitiveValue]]", "string", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i", "0", "string", "/", - "/", "1", "string", "^", "^", "2", "string", "\\", "\\", "3", "string", "d", "d", "4", - "string", "+", "+", "5", "string", "\\", "\\", "6", "string", ".", ".", "7", "string", - "\\", "\\", "8", "string", "d", "d", "9", "string", "+", "+", "10", "string", "$", "$", - "11", "string", "/", "/", "12", "string", "i", "i", "length", "number", "13", "13"} }, - { "string17", { "object", "Object", "String{[[PrimitiveValue]]: [object ArrayBuffer]}", - "[object ArrayBuffer]", "[[PrimitiveValue]]", "string", "[object ArrayBuffer]", - "[object ArrayBuffer]", "0", "string", "[", "[", "1", "string", "o", "o", "2", "string", - "b", "b", "3", "string", "j", "j", "4", "string", "e", "e", "5", "string", "c", "c", "6", - "string", "t", "t", "7", "string", " ", " ", "8", "string", "A", "A", "9", "string", "r", - "r", "10", "string", "r", "r", "11", "string", "a", "a", "12", "string", "y", "y", "13", - "string", "B", "B", "14", "string", "u", "u", "15", "string", "f", "f", "16", "string", - "f", "f", "17", "string", "e", "e", "18", "string", "r", "r", "19", "string", "]", "]", - "length", "number", "20", "20" } }, - { "string18", { "object", "Object", - "String{[[PrimitiveValue]]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[PrimitiveValue]]", "string", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "0", "string", "0", "0", "1", - "string", ",", ",", "2", "string", "0", "0", "3", "string", ",", ",", "4", "string", "0", - "0", "5", "string", ",", ",", "6", "string", "0", "0", "7", "string", ",", ",", "8", - "string", "0", "0", "9", "string", ",", ",", "10", "string", "0", "0", "11", "string", - ",", ",", "12", "string", "0", "0", "13", "string", ",", ",", "14", "string", "0", "0", - "15", "string", ",", ",", "16", "string", "0", "0", "17", "string", ",", ",", "18", - "string", "0", "0", "19", "string", ",", ",", "20", "string", "0", "0", "21", "string", - ",", ",", "22", "string", "0", "0", "23", "string", ",", ",", "24", "string", "0", "0", - "25", "string", ",", ",", "26", "string", "0", "0", "27", "string", ",", ",", "28", - "string", "0", "0", "29", "string", ",", ",", "30", "string", "0", "0", "31", "string", - ",", ",", "32", "string", "0", "0", "33", "string", ",", ",", "34", "string", "0", "0", - "35", "string", ",", ",", "36", "string", "0", "0", "37", "string", ",", ",", "38", - "string", "0", "0", "39", "string", ",", ",", "40", "string", "0", "0", "41", "string", - ",", ",", "42", "string", "0", "0", "43", "string", ",", ",", "44", "string", "0", "0", - "45", "string", ",", ",", "46", "string", "0", "0", "length", "number", "47", "47" } }, - { "string19", { "object", "Object", "String{[[PrimitiveValue]]: [object DataView]}", "[object DataView]", - "[[PrimitiveValue]]", "string", "[object DataView]", "[object DataView]", - "0", "string", "[", "[", "1", "string", "o", "o", "2", "string", "b", "b", "3", "string", - "j", "j", "4", "string", "e", "e", "5", "string", "c", "c", "6", "string", "t", "t", "7", - "string", " ", " ", "8", "string", "D", "D", "9", "string", "a", "a", "10", "string", "t", - "t", "11", "string", "a", "a", "12", "string", "V", "V", "13", "string", "i", "i", "14", - "string", "e", "e", "15", "string", "w", "w", "16", "string", "]", "]", "length", "number", - "17", "17" } }, - { "string20", { "object", "Object", "String{[[PrimitiveValue]]: [object Map]}", "[object Map]", - "[[PrimitiveValue]]", "string", "[object Map]", "[object Map]", "0", "string", "[", "[", - "1", "string", "o", "o", "2", "string", "b", "b", "3", "string", "j", "j", "4", "string", - "e", "e", "5", "string", "c", "c", "6", "string", "t", "t", "7", "string", " ", " ", "8", - "string", "M", "M", "9", "string", "a", "a", "10", "string", "p", "p", "11", "string", - "]", "]", "length", "number", "12", "12" } }, - { "string21", { "object", "Object", "String{[[PrimitiveValue]]: Cannot get source code of funtion}", - "Cannot get source code of funtion", "[[PrimitiveValue]]", "string", - "Cannot get source code of funtion", "Cannot get source code of funtion", "0", "string", - "C", "C", "1", "string", "a", "a", "2", "string", "n", "n", "3", "string", "n", "n", "4", - "string", "o", "o", "5", "string", "t", "t", "6", "string", " ", " ", "7", "string", "g", - "g", "8", "string", "e", "e", "9", "string", "t", "t", "10", "string", " ", " ", "11", - "string", "s", "s", "12", "string", "o", "o", "13", "string", "u", "u", "14", "string", - "r", "r", "15", "string", "c", "c", "16", "string", "e", "e", "17", "string", " ", " ", - "18", "string", "c", "c", "19", "string", "o", "o", "20", "string", "d", "d", "21", - "string", "e", "e", "22", "string", " ", " ", "23", "string", "o", "o", "24", "string", - "f", "f", "25", "string", " ", " ", "26", "string", "f", "f", "27", "string", "u", "u", - "28", "string", "n", "n", "29", "string", "t", "t", "30", "string", "i", "i", "31", - "string", "o", "o", "32", "string", "n", "n", "length", "number", "33", "33" } }, - { "bigint1", { "bigint", "9007199254740991n", "9007199254740991" } }, - { "bigint2", { "bigint", "9007199254740991n", "9007199254740991" } }, - { "bigint3", { "bigint", "9007199254740991n", "9007199254740991" } }, - { "bigint4", { "bigint", "9007199254740991n", "9007199254740991" } }, - { "bigint5", { "bigint", "9007199254740991n", "9007199254740991" } }, - { "bigint6", { "bigint", "9007199254740991n", "9007199254740991" } }, - { "bigint7", { "bigint", "999n", "999" } }, - { "bigint8", { "bigint", "9007199254741990n", "9007199254741990" } }, - { "bigint9", { "bigint", "-9007199254739992n", "-9007199254739992" } }, - { "bigint10", { "bigint", "8998192055486250009n", "8998192055486250009" } }, - { "bigint11", { "bigint", "0n", "0" } }, - { "bigint12", { "bigint", "999n", "999" } }, - { "bigint13", { "bigint", "10000000000n", "10000000000" } }, - { "bigint14", { "bigint", "888888888888888888888888888888888888888888888n", - "888888888888888888888888888888888888888888888" } }, - { "bigint15", { "bigint", "16383n", "16383" } }, - { "bigint16", { "bigint", "0n", "0" } }, - { "bigint17", { "bigint", "0n", "0" } }, - { "bigint18", { "bigint", "122999999999999994846185700645503654167417192448n", - "122999999999999994846185700645503654167417192448" } }, - { "bigint19", { "bigint", "1234567n", "1234567" } }, - { "bigint20", { "bigint", "65535n", "65535" } }, - { "boolean1", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean2", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean3", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean4", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "boolean5", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean6", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean7", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean8", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "boolean9", { "boolean", "true", "true" } }, - { "boolean10", { "boolean", "false", "false" } }, - { "boolean11", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "boolean12", { "boolean", "false", "false" } }, - { "boolean13", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "boolean14", { "boolean", "true", "true" } }, - { "boolean15", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean16", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "boolean17", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean18", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean19", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean20", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean21", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean22", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean23", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "boolean24", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean25", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean26", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean27", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean28", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "boolean29", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", "true", "[[PrimitiveValue]]", - "boolean", "true", "true" } }, - { "map1", { "object", "map", "Map", "Map(0)", "[object Map]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "map2", { "object", "map", "Map", "Map(2) {1 => 'hello', 2 => 'world'}", "[object Map]", "size", - "number", "2", "2", "[[Entries]]", "object", "array", "Array", "Array(2)", - "[object Object],[object Object]" } }, - { "map3", { "object", "map", "Map", "Map(1) {NaN => 'NaN'}", "[object Map]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map4", { "object", "map", "Map", "Map(0)", "[object Map]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "", "0", "string", "hello", "hello" } }, - { "map5", { "object", "map", "Map", "Map(4) {0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three'}", - "[object Map]", "size", "number", "4", "4", "[[Entries]]", "object", "array", "Array", - "Array(4)", "[object Object],[object Object],[object Object],[object Object]" } }, - { "map6", { "object", "map", "Map", "Map(1) {Object => 'set0'}", "[object Map]", "size", "number", "1", - "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map7", { "object", "map", "Map", "Map(1) {1 => 'number0'}", "[object Map]", "size", "number", "1", "1", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map8", { "object", "map", "Map", "Map(1) {'helloworld' => 'string0'}", "[object Map]", "size", - "number", "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", - "[object Object]" } }, - { "map9", { "object", "map", "Map", "Map(1) {Object => 'object0'}", "[object Map]", "size", "number", "1", - "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map10", { "object", "map", "Map", "Map(1) {undefined => 'undefined0'}", "[object Map]", "size", - "number", "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", - "[object Object]" } }, - { "map11", { "object", "map", "Map", "Map(1) {Object => 'array0'}", "[object Map]", "size", "number", "1", - "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map12", { "object", "map", "Map", "Map(1) {Object => 'map3'}", "[object Map]", "size", "number", "1", - "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map13", { "object", "map", "Map", "Map(1) {Object => 'generator0'}", "[object Map]", "size", "number", - "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map14", { "object", "map", "Map", "Map(1) {Object => 'regexp0'}", "[object Map]", "size", "number", - "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map15", { "object", "map", "Map", "Map(1) {Object => 'arraybuffer0'}", "[object Map]", "size", - "number", "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", - "[object Object]" } }, - { "map16", { "object", "map", "Map", "Map(1) {Object => 'uint8array0'}", "[object Map]", "size", "number", - "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map17", { "object", "map", "Map", "Map(1) {Object => 'dataview0'}", "[object Map]", "size", "number", - "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "map18", { "object", "map", "Map", "Map(1) {8998192055486250009 => 'bigint10'}", "[object Map]", "size", - "number", "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", - "[object Object]" } }, - { "map19", { "object", "map", "Map", "Map(1) {Object => 'function0'}", "[object Map]", "size", "number", - "1", "1", "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "object1", { "object", "Object", "Object", "[object Object]", "0", "string", "zero", "zero", "1", - "string", "one", "one", "2", "string", "two", "two", "3", "string", "three", "three", "4", - "string", "four", "four", "5", "string", "five", "five" } }, - { "object2", { "object", "Object", "Object", "[object Object]", "0", "string", "zero", "zero", "1", - "string", "one", "one", "2", "string", "two", "two", "3", "string", "three", "three", "4", - "string", "four", "four", "5", "string", "five", "five" } }, - { "object3", { "object", "Object", "Object", "[object Object]", "0", "string", "zero", "zero", "1", - "string", "one", "one", "2", "string", "two", "two", "3", "string", "three", "three", "4", - "string", "four", "four", "5", "string", "five", "five" } }, - { "object4", { "object", "set", "Set", "Set(0)", "[object Set]", "size", "number", "0", "0", - "[[Entries]]", "object", "array", "Array", "Array(0)", "" } }, - { "object5", { "object", "Object", "String{[[PrimitiveValue]]: helloworld}", "helloworld", - "[[PrimitiveValue]]", "string", "helloworld", "helloworld", "0", "string", "h", "h", "1", - "string", "e", "e", "2", "string", "l", "l", "3", "string", "l", "l", "4", "string", "o", - "o", "5", "string", "w", "w", "6", "string", "o", "o", "7", "string", "r", "r", "8", - "string", "l", "l", "9", "string", "d", "d", "length", "number", "10", "10" } }, - { "object6", { "object", "map", "Map", "Map(0)", "[object Map]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "object7", { "object", "Object", "Number{[[PrimitiveValue]]: 1}", "1", "[[PrimitiveValue]]", "number", - "1", "1" } }, - { "object8", { "object", "Object", "Object", "[object Object]", "key0", "string", "value0", "value0", - "key1", "number", "100", "100" } }, - { "object9", { "object", "Object", "Object", "[object Object]", "none" } }, - { "object10", { "object", "array", "Array", "Array(2)", "Apple,Banana", "0", "string", "Apple", "Apple", - "1", "string", "Banana", "Banana", "length", "number", "2", "2" } }, - { "object11", { "object", "Object", "Object", "8998192055486250009", "none" } }, - { "object12", { "function", "Generator", "function* generator0( { [js code] }", - "Cannot get source code of funtion" } }, - { "object13", { "object", "regexp", "RegExp", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i", "global", "boolean", - "false", "false", "ignoreCase", "boolean", "true", "true", "multiline", "boolean", "false", - "false", "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", - "unicode", "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", - "string", "i", "i", "source", "string", "^\\d+\\.\\d+$", "^\\d+\\.\\d+$", "lastIndex", - "number", "0", "0" } }, - { "object14", { "object", "Object", "Object", "999", "none" } }, - { "object15", { "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "[object ArrayBuffer]", - "[[Int8Array]]", "object", "Object", "Int8Array(24)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint8Array]]", "object", "Object", - "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Uint8ClampedArray]]", "object", "Object", "Object", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Int16Array]]", "object", "Object", - "Int16Array(12)", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint16Array]]", "object", "Object", - "Object", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", - "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Object", - "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Object", "0,0,0,0,0,0", - "[[Float64Array]]", "object", "Object", "Object", "0,0,0", "[[BigInt64Array]]", "object", - "Object", "Object", "0,0,0", "[[BigUint64Array]]", - "object", "Object", "Object", "0,0,0" } }, - { "object16", { "object", "Object", "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "0", "number", "0", "0", "1", "number", "0", "0", "2", "number", "0", "0", "3", "number", - "0", "0", "4", "number", "0", "0", "5", "number", "0", "0", "6", "number", "0", "0", "7", - "number", "0", "0", "8", "number", "0", "0", "9", "number", "0", "0", "10", "number", "0", - "0", "11", "number", "0", "0", "12", "number", "0", "0", "13", "number", "0", "0", "14", - "number", "0", "0", "15", "number", "0", "0", "16", "number", "0", "0", "17", "number", - "0", "0", "18", "number", "0", "0", "19", "number", "0", "0", "20", "number", "0", "0", - "21", "number", "0", "0", "22", "number", "0", "0", "23", "number", "0", "0" } }, - { "object17", { "object", "dataview", "Dataview", "DataView(24)", "[object DataView]", "buffer", - "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "[object ArrayBuffer]", - "byteLength", "number", "24", "24", "byteOffset", "number", "0", "0" } }, - { "object18", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "object19", { "function", "Function", "function function0( { [js code] }", - "Cannot get source code of funtion" } }, - { "regExp1", { "object", "regexp", "RegExp", "/^a/g", "/^a/g", "global", "boolean", "true", "true", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "false", "false", - "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", "unicode", - "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", "g", - "g", "source", "string", "^a", "^a", "lastIndex", "number", "0", "0" } }, - { "regExp2", { "object", "regexp", "RegExp", "/^ab+c/g", "/^ab+c/g", "global", "boolean", "true", "true", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "false", "false", - "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", "unicode", - "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", "g", - "g", "source", "string", "^ab+c", "^ab+c", "lastIndex", "number", "0", "0" } }, - { "regExp3", { "object", "regexp", "RegExp", "/123$/", "/123$/", "global", "boolean", "false", "false", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "false", "false", - "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", "unicode", - "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", "", - "", "source", "string", "123$", "123$", "lastIndex", "number", "0", "0" } }, - { "regExp4", { "object", "regexp", "RegExp", "/\\d/i", "/\\d/i", "global", "boolean", "false", "false", - "ignoreCase", "boolean", "true", "true", "multiline", "boolean", "false", "false", "dotAll", - "boolean", "false", "false", "hasIndices", "boolean", "false", "false", "unicode", - "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", "i", - "i", "source", "string", "\\d", "\\d", "lastIndex", "number", "0", "0" } }, - { "regExp5", { "object", "regexp", "RegExp", "/^[a-zA-Z]/w{5,17}$/iu", "/^[a-zA-Z]\\/w{5,17}$/iu", - "global", "boolean", "false", "false", "ignoreCase", "boolean", "true", "true", "multiline", - "boolean", "false", "false", "dotAll", "boolean", "false", "false", "hasIndices", "boolean", - "false", "false", "unicode", "boolean", "true", "true", "sticky", "boolean", "false", - "false", "flags", "string", "iu", "iu", "source", "string", - "^[a-zA-Z]/w{5,17}$", "^[a-zA-Z]/w{5,17}$", "lastIndex", "number", "0", "0" } }, - { "regExp6", { "object", "regexp", "RegExp", "/[A-Z]/m", "/[A-Z]/m", "global", "boolean", "false", "false", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "true", "true", "dotAll", - "boolean", "false", "false", "hasIndices", "boolean", "false", "false", "unicode", - "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", "m", - "m", "source", "string", "[A-Z]", "[A-Z]", "lastIndex", "number", "0", "0" } }, - { "regExp7", { "object", "regexp", "RegExp", "/(/d{3}-|/d{4}-)?(/d{8}|/d{7})?/gm", - "/(\\/d{3}-|\\/d{4}-)?(\\/d{8}|\\/d{7})?/gm", "global", "boolean", "true", "true", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "true", "true", "dotAll", - "boolean", "false", "false", "hasIndices", "boolean", "false", "false", "unicode", - "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", "gm", - "gm", "source", "string", "(/d{3}-|/d{4}-)?(/d{8}|/d{7})?", - "(/d{3}-|/d{4}-)?(/d{8}|/d{7})?", "lastIndex", "number", "0", "0" } }, - { "regExp8", { "object", "regexp", "RegExp", "/[a-z]/y", "/[a-z]/y", "global", "boolean", "false", "false", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "false", "false", - "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", "unicode", - "boolean", "false", "false", "sticky", "boolean", "true", "true", "flags", "string", "y", - "y", "source", "string", "[a-z]", "[a-z]", "lastIndex", "number", "0", "0" } }, - { "regExp9", { "object", "regexp", "RegExp", "/\\s/u", "/\\s/u", "global", "boolean", "false", "false", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "false", "false", - "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", - "unicode", "boolean", "true", "true", "sticky", "boolean", "false", "false", "flags", - "string", "u", "u", "source", "string", "\\s", "\\s", "lastIndex", "number", "0", "0" } }, - { "regExp10", { "object", "regexp", "RegExp", "/a+/s", "/a+/s", "global", "boolean", "false", "false", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "false", "false", - "dotAll", "boolean", "true", "true", "hasIndices", "boolean", "true", "true", "unicode", - "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", - "s", "s", "source", "string", "a+", "a+", "lastIndex", "number", "0", "0" } }, - { "regExp11", { "object", "regexp", "RegExp", "/(d+-)?(d{4}-?d{7}|d{3}-?d{8}|^d{7,8})(-d+)?/s", - "/(d+-)?(d{4}-?d{7}|d{3}-?d{8}|^d{7,8})(-d+)?/s", "global", "boolean", "false", "false", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "false", "false", - "dotAll", "boolean", "true", "true", "hasIndices", "boolean", "true", "true", "unicode", - "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", - "s", "s", "source", "string", "(d+-)?(d{4}-?d{7}|d{3}-?d{8}|^d{7,8})(-d+)?", - "(d+-)?(d{4}-?d{7}|d{3}-?d{8}|^d{7,8})(-d+)?", "lastIndex", "number", "0", "0" } }, - { "regExp12", { "object", "regexp", "RegExp", "/a?/gy", "/a?/gy", "global", "boolean", "true", "true", - "ignoreCase", "boolean", "false", "false", "multiline", "boolean", "false", "false", - "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", - "unicode", "boolean", "false", "false", "sticky", "boolean", "true", "true", "flags", - "string", "gy", "gy", "source", "string", "a?", "a?", "lastIndex", "number", "0", "0" } }, - { "regExp13", { "object", "regexp", "RegExp", - "//^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$//", - "/\\/^((0([1-9]{1}))|(1[1|2]))\\/(([0-2]([1-9]{1}))|(3[0|1]))\\/(d{2}|d{4})$\\//", - "global", "boolean", "false", "false", "ignoreCase", "boolean", "false", "false", - "multiline", "boolean", "false", "false", "dotAll", "boolean", "false", "false", - "hasIndices", "boolean", "false", "false", "unicode", "boolean", "false", "false", - "sticky", "boolean", "false", "false", "flags", "string", "", "", "source", "string", - "/^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$/", - "/^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$/", "lastIndex", - "number", "0", "0" } }, - { "regExp14", { "object", "regexp", "RegExp", "/a*/gimy", "/a*/gimy", "global", "boolean", "true", "true", - "ignoreCase", "boolean", "true", "true", "multiline", "boolean", "true", "true", "dotAll", - "boolean", "false", "false", "hasIndices", "boolean", "false", "false", "unicode", - "boolean", "false", "false", "sticky", "boolean", "true", "true", "flags", "string", - "gimy", "gimy", "source", "string", "a*", "a*", "lastIndex", "number", "0", "0" } }, - { "regExp15", { "object", "regexp", "RegExp", "/^[/w-]+(/.[/w-]+)*@[/w-]+(/.[/w-]+)+$/gi", - "/^[\\/w-]+(\\/.[\\/w-]+)*@[\\/w-]+(\\/.[\\/w-]+)+$/gi", "global", "boolean", "true", - "true", "ignoreCase", "boolean", "true", "true", "multiline", "boolean", "false", - "false", "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", - "unicode", "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", - "string", "gi", "gi", "source", "string", "^[/w-]+(/.[/w-]+)*@[/w-]+(/.[/w-]+)+$", - "^[/w-]+(/.[/w-]+)*@[/w-]+(/.[/w-]+)+$", "lastIndex", "number", "0", "0" } }, - { "regExp16", { "object", "regexp", "RegExp", "/a|b/gimsy", "/a|b/gimsy", "global", "boolean", "true", - "true", "ignoreCase", "boolean", "true", "true", "multiline", "boolean", "true", "true", - "dotAll", "boolean", "true", "true", "hasIndices", "boolean", "true", "true", "unicode", - "boolean", "false", "false", "sticky", "boolean", "true", "true", "flags", "string", - "gimsy", "gimsy", "source", "string", "a|b", "a|b", "lastIndex", "number", "0", "0" } }, - { "regExp17", { "object", "regexp", "RegExp", - "/^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$/", - "/^((0([1-9]{1}))|(1[1|2]))\\/(([0-2]([1-9]{1}))|(3[0|1]))\\/(d{2}|d{4})$/", "global", - "boolean", "false", "false", "ignoreCase", "boolean", "false", "false", "multiline", - "boolean", "false", "false", "dotAll", "boolean", "false", "false", "hasIndices", - "boolean", "false", "false", "unicode", "boolean", "false", "false", "sticky", "boolean", - "false", "false", "flags", "string", "", "", "source", "string", - "^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$", - "^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$", "lastIndex", - "number", "0", "0" } }, - { "regExp18", { "object", "regexp", "RegExp", "/\\/<(.*)>.*<\\/\\/\\/1>|<(.*) \\/\\/>/i", - "/\\\\/<(.*)>.*<\\\\/\\\\/\\\\/1>|<(.*) \\\\/\\\\/>/i", "global", "boolean", "false", - "false", "ignoreCase", "boolean", "true", "true", "multiline", "boolean", "false", - "false", "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", - "unicode", "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", - "string", "i", "i", "source", "string", - "\\/<(.*)>.*<\\/\\/\\/1>|<(.*) \\/\\/>", "\\/<(.*)>.*<\\/\\/\\/1>|<(.*) \\/\\/>", - "lastIndex", "number", "0", "0" } }, - { "regExp19", { "object", "regexp", "RegExp", "/^[1-9]*[1-9][0-9]*$/m", "/^[1-9]*[1-9][0-9]*$/m", - "global", "boolean", "false", "false", "ignoreCase", "boolean", "false", "false", - "multiline", "boolean", "true", "true", "dotAll", "boolean", "false", "false", - "hasIndices", "boolean", "false", "false", "unicode", "boolean", "false", "false", - "sticky", "boolean", "false", "false", "flags", "string", "m", "m", "source", - "string", "^[1-9]*[1-9][0-9]*$", "^[1-9]*[1-9][0-9]*$", "lastIndex", "number", - "0", "0" } }, - { "regExp20", { "object", "regexp", "RegExp", "/^[a-zA-Z]\\/w{5,17}$/", "/^[a-zA-Z]\\\\/w{5,17}$/", - "global", "boolean", "false", "false", "ignoreCase", "boolean", "false", "false", - "multiline", "boolean", "false", "false", "dotAll", "boolean", "false", "false", - "hasIndices", "boolean", "false", "false", "unicode", "boolean", "false", "false", - "sticky", "boolean", "false", "false", "flags", "string", "", "", "source", "string", - "^[a-zA-Z]\\/w{5,17}$", "^[a-zA-Z]\\/w{5,17}$", "lastIndex", "number", "0", "0" } }, - { "regExp21", { "object", "regexp", "RegExp", "/^[0-9a-zA-Z_]{1,}$/u", "/^[0-9a-zA-Z_]{1,}$/u", "global", - "boolean", "false", "false", "ignoreCase", "boolean", "false", "false", "multiline", - "boolean", "false", "false", "dotAll", "boolean", "false", "false", "hasIndices", - "boolean", "false", "false", "unicode", "boolean", "true", "true", "sticky", "boolean", - "false", "false", "flags", "string", "u", "u", "source", "string", "^[0-9a-zA-Z_]{1,}$", - "^[0-9a-zA-Z_]{1,}$", "lastIndex", "number", "0", "0" } }, - { "proxy", { "object", "proxy", "Object", "Proxy", "[object Object]", - "[[Target]]", "object", "Object", "Object", "[object Object]", - "[[Handler]]", "object", "Object", "Object", "[object Object]", - "[[IsRevoked]]", "boolean", "false", "false" } }, - { "proxy1", { "object", "proxy", "Object", "Proxy", "[object Object]", - "[[Target]]", "object", "Object", "Object", "[object Object]", - "[[Handler]]", "object", "Object", "Object", "[object Object]", - "[[IsRevoked]]", "boolean", "false", "false" } }, - { "proxy2", { "object", "Object", "Object", "[object Object]", - "proxy", "object", "proxy", "Object", "Proxy", "[object Object]", - "revoke", "function", "Function", "function ( { [native code] }", - "function () { [native code] }" } }, - { "revoke", { "function", "Function", "function ( { [native code] }", "function () { [native code] }" } }, - { "target", { "object", "Object", "Object", "[object Object]", - "name", "string", "openharmony", "openharmony", - "age", "number", "3", "3" } }, - { "handler", { "object", "Object", "Object", "[object Object]", - "get", "function", "Function", "function get( { [js code] }", - "Cannot get source code of funtion", - "set", "function", "Function", "function set( { [js code] }", - "Cannot get source code of funtion" } }, - { "resolveHandler", { "function", "Function", "function resolveHandler( { [js code] }", - "Cannot get source code of funtion"} }, - { "result", { "object", "Object", "Object", "[object Object]", "flag", "boolean", - "true", "true"} }, - { "a", { "object", "promise", "Promise", "Promise", "[object Promise]", - "[[PromiseState]]", "string", "Fulfilled", "Fulfilled", "[[PromiseResult]]", - "object", "Object", "Object", "[object Object]"} }, + // reply success and run + {SocketAction::SEND, "success"}, + {SocketAction::SEND, "resume"}, + {SocketAction::RECV, "Debugger.resumed", ActionRule::STRING_CONTAIN}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, }; + } - int32_t index_ {0}; - const EcmaVM *vm_ {nullptr}; - RuntimeImpl *runtime_ {nullptr}; - }; + std::pair GetEntryPoint() override + { + return {pandaFile_, entryPoint_}; + } + ~JsVariableFirstTest() = default; +private: + std::string pandaFile_ = DEBUGGER_ABC_DIR "variable_first.abc"; + std::string sourceFile_ = DEBUGGER_JS_DIR "variable_first.js"; std::string entryPoint_ = "_GLOBAL::func_main_0"; - JSPtLocation location_ {nullptr, JSPtLocation::EntityId(0), 0}; - size_t breakpointCounter_ = 0; + + const std::map> variableMap_ = { + { "nop", { "undefined" } }, + { "foo", { "function", "Function", "function foo( { [js code] }", "function foo( { [js code] }" } }, + { "array0", { "object", "array", "Array", "Array(2)", "Array(2)" } }, + { "arraybuffer0", { "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "ArrayBuffer(24)" } }, + { "boolean23", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "boolean0", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "boolean12", { "boolean", "false", "false" } }, + { "boolean11", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "boolean8", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "boolean16", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "boolean4", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "map8", { "object", "map", "Map", "Map(1) {'helloworld' => 'string0'}", + "Map(1) {'helloworld' => 'string0'}" } }, + { "map4", { "object", "map", "Map", "Map(0)", "Map(0)" } }, + { "regExp7", { "object", "regexp", "RegExp", "/(/d{3}-|/d{4}-)?(/d{8}|/d{7})?/gm", + "/(/d{3}-|/d{4}-)?(/d{8}|/d{7})?/gm" } }, + { "set14", { "object", "set", "Set", "Set(0)", "Set(0)" } }, + { "boolean27", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "string8", { "object", "Object", "String{[[PrimitiveValue]]: [object Set]}", + "String{[[PrimitiveValue]]: [object Set]}" } }, + { "string11", { "object", "Object", "String{[[PrimitiveValue]]: [object Object]}", + "String{[[PrimitiveValue]]: [object Object]}" } }, + { "regExp18", { "object", "regexp", "RegExp", "/\\/<(.*)>.*<\\/\\/\\/1>|<(.*) \\/\\/>/i", + "/\\/<(.*)>.*<\\/\\/\\/1>|<(.*) \\/\\/>/i" } }, + { "regexp0", { "object", "regexp", "RegExp", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i" } }, + { "regExp1", { "object", "regexp", "RegExp", "/^a/g", "/^a/g" } }, + { "regExp3", { "object", "regexp", "RegExp", "/123$/", "/123$/" } }, + { "regExp13", { "object", "regexp", "RegExp", + "//^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$//", + "//^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$//" } }, + { "boolean25", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "map0", { "object", "map", "Map", "Map(0)", "Map(0)" } }, + { "number15", { "object", "Object", "Number{[[PrimitiveValue]]: 1.7976931348623157e+308}", + "Number{[[PrimitiveValue]]: 1.7976931348623157e+308}" } }, + { "number24", { "object", "Object", "Number{[[PrimitiveValue]]: 65535}", + "Number{[[PrimitiveValue]]: 65535}" } }, + { "boolean7", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "number1", { "number", "65535", "65535" } }, + { "number3", { "number", "10000000000", "10000000000" } }, + { "regExp16", { "object", "regexp", "RegExp", "/a|b/gimsy", "/a|b/gimsy" } }, + { "regExp4", { "object", "regexp", "RegExp", "/\\d/i", "/\\d/i" } }, + { "regExp8", { "object", "regexp", "RegExp", "/[a-z]/y", "/[a-z]/y" } }, + { "regExp19", { "object", "regexp", "RegExp", "/^[1-9]*[1-9][0-9]*$/m", "/^[1-9]*[1-9][0-9]*$/m" } }, + { "regExp9", { "object", "regexp", "RegExp", "/\\s/u", "/\\s/u" } }, + { "regExp6", { "object", "regexp", "RegExp", "/[A-Z]/m", "/[A-Z]/m" } }, + { "regExp11", { "object", "regexp", "RegExp", "/(d+-)?(d{4}-?d{7}|d{3}-?d{8}|^d{7,8})(-d+)?/s", + "/(d+-)?(d{4}-?d{7}|d{3}-?d{8}|^d{7,8})(-d+)?/s" } }, + { "regExp5", { "object", "regexp", "RegExp", "/^[a-zA-Z]/w{5,17}$/iu", "/^[a-zA-Z]/w{5,17}$/iu" } }, + { "regExp2", { "object", "regexp", "RegExp", "/^ab+c/g", "/^ab+c/g" } }, + { "regExp12", { "object", "regexp", "RegExp", "/a?/gy", "/a?/gy" } }, + { "regExp21", { "object", "regexp", "RegExp", "/^[0-9a-zA-Z_]{1,}$/u", "/^[0-9a-zA-Z_]{1,}$/u" } }, + { "regExp14", { "object", "regexp", "RegExp", "/a*/gimy", "/a*/gimy" } }, + { "regExp10", { "object", "regexp", "RegExp", "/a+/s", "/a+/s" } }, + { "regExp15", { "object", "regexp", "RegExp", "/^[/w-]+(/.[/w-]+)*@[/w-]+(/.[/w-]+)+$/gi", + "/^[/w-]+(/.[/w-]+)*@[/w-]+(/.[/w-]+)+$/gi" } }, + { "regExp20", { "object", "regexp", "RegExp", "/^[a-zA-Z]\\/w{5,17}$/", "/^[a-zA-Z]\\/w{5,17}$/" } }, + { "regExp17", { "object", "regexp", "RegExp", + "/^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$/", + "/^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$/" } }, + { "string4", { "string", "helloworld", "helloworld" } }, + { "string0", { "string", "helloworld", "helloworld" } }, + { "string3", { "string", "world", "world" } }, + { "string5", { "string", "e", "e" } }, + { "string6", { "string", "1", "1" } }, + { "string2", { "string", "", "" } }, + { "string1", { "string", "", "" } }, + { "string15", { "object", "Object", "String{[[PrimitiveValue]]: Cannot get source code of funtion}", + "String{[[PrimitiveValue]]: Cannot get source code of funtion}" } }, + { "string14", { "object", "Object", "String{[[PrimitiveValue]]: 999}", "String{[[PrimitiveValue]]: 999}" } }, + { "string21", { "object", "Object", "String{[[PrimitiveValue]]: Cannot get source code of funtion}", + "String{[[PrimitiveValue]]: Cannot get source code of funtion}" } }, + { "string20", { "object", "Object", "String{[[PrimitiveValue]]: [object Map]}", + "String{[[PrimitiveValue]]: [object Map]}" } }, + { "string17", { "object", "Object", "String{[[PrimitiveValue]]: [object ArrayBuffer]}", + "String{[[PrimitiveValue]]: [object ArrayBuffer]}" } }, + { "string19", { "object", "Object", "String{[[PrimitiveValue]]: [object DataView]}", + "String{[[PrimitiveValue]]: [object DataView]}" } }, + { "string12", { "object", "Object", "String{[[PrimitiveValue]]: undefined}", + "String{[[PrimitiveValue]]: undefined}" } }, + { "string13", { "object", "Object", "String{[[PrimitiveValue]]: Apple,Banana}", + "String{[[PrimitiveValue]]: Apple,Banana}" } }, + { "string18", { "object", "Object", + "String{[[PrimitiveValue]]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}", + "String{[[PrimitiveValue]]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}" } }, + { "string9", { "object", "Object", "String{[[PrimitiveValue]]: 1}", "String{[[PrimitiveValue]]: 1}" } }, + { "string7", { "object", "Object", "String{[[PrimitiveValue]]: }", "String{[[PrimitiveValue]]: }" } }, + { "object19", { "function", "Function", "function function0( { [js code] }", + "function function0( { [js code] }" } }, + { "boolean21", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "number17", { "object", "Object", "Number{[[PrimitiveValue]]: 10000000000}", + "Number{[[PrimitiveValue]]: 10000000000}" } }, + { "number12", { "number", "0.000015259021896696422", "0.000015259021896696422" } }, + { "number2", { "number", "5e-324", "5e-324" } }, + { "boolean18", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean28", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean26", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean22", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "set5", { "object", "set", "Set", "Set(2) {'Apple', 'Banana'}", + "Set(2) {'Apple', 'Banana'}" } }, + { "boolean19", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "set11", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "set10", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "set16", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "boolean17", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean29", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "map1", { "object", "map", "Map", "Map(0)", "Map(0)" } }, + { "generator0", { "function", "Generator", "function* generator0( { [js code] }", + "function* generator0( { [js code] }" } }, + { "number23", { "object", "Object", "Number{[[PrimitiveValue]]: -65534}", + "Number{[[PrimitiveValue]]: -65534}" } }, + { "number20", { "object", "Object", "Number{[[PrimitiveValue]]: 1.23e+47}", + "Number{[[PrimitiveValue]]: 1.23e+47}" } }, + { "number19", { "object", "Object", "Number{[[PrimitiveValue]]: 16383}", + "Number{[[PrimitiveValue]]: 16383}" } }, + { "number21", { "object", "Object", "Number{[[PrimitiveValue]]: 1}", + "Number{[[PrimitiveValue]]: 1}" } }, + { "number26", { "object", "Object", "Number{[[PrimitiveValue]]: 1}", + "Number{[[PrimitiveValue]]: 1}" } }, + { "number6", { "object", "Object", "Number{[[PrimitiveValue]]: 999}", + "Number{[[PrimitiveValue]]: 999}" } }, + { "number18", { "object", "Object", "Number{[[PrimitiveValue]]: 2199023255551}", + "Number{[[PrimitiveValue]]: 2199023255551}" } }, + { "number25", { "object", "Object", "Number{[[PrimitiveValue]]: 0.000015259021896696422}", + "Number{[[PrimitiveValue]]: 0.000015259021896696422}" } }, + { "number22", { "object", "Object", "Number{[[PrimitiveValue]]: 65536}", + "Number{[[PrimitiveValue]]: 65536}" } }, + { "number14", { "object", "Object", "Number{[[PrimitiveValue]]: 0}", + "Number{[[PrimitiveValue]]: 0}" } }, + { "number16", { "object", "Object", "Number{[[PrimitiveValue]]: 5e-324}", + "Number{[[PrimitiveValue]]: 5e-324}" } }, + { "number4", { "number", "2199023255551", "2199023255551" } }, + { "number0", { "number", "1", "1" } }, + { "number8", { "number", "1", "1" } }, + { "number13", { "number", "1", "1" } }, + { "number11", { "number", "65535", "65535" } }, + { "number7", { "number", "1.23e+47", "1.23e+47" } }, + { "number9", { "number", "65536", "65536" } }, + { "number5", { "number", "16383", "16383" } }, + { "number10", { "number", "-65534", "-65534" } }, + { "number27", { "number", "1.7976931348623157e+308", "1.7976931348623157e+308" } }, + { "set9", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "set3", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "boolean24", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean1", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean2", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean3", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean9", { "boolean", "true", "true" } }, + { "boolean20", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean6", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean15", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "boolean14", { "boolean", "true", "true" } }, + { "object11", { "object", "Object", "Object", "Object" } }, + { "object12", { "function", "Generator", "function* generator0( { [js code] }", + "function* generator0( { [js code] }" } }, + { "function0", { "function", "Function", "function function0( { [js code] }", + "function function0( { [js code] }" } }, + { "boolean10", { "boolean", "false", "false" } }, + { "boolean13", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "string16", { "object", "Object", "String{[[PrimitiveValue]]: /^\\d+\\.\\d+$/i}", + "String{[[PrimitiveValue]]: /^\\d+\\.\\d+$/i}" } }, + { "string10", { "object", "Object", "String{[[PrimitiveValue]]: helloworld}", + "String{[[PrimitiveValue]]: helloworld}" } }, + { "dataview0", { "object", "dataview", "Dataview", "DataView(24)", "DataView(24)" } }, + { "map13", { "object", "map", "Map", "Map(1) {Object => 'generator0'}", "Map(1) {Object => 'generator0'}" } }, + { "map18", { "object", "map", "Map", "Map(1) {8998192055486250009 => 'bigint10'}", + "Map(1) {8998192055486250009 => 'bigint10'}" } }, + { "map14", { "object", "map", "Map", "Map(1) {Object => 'regexp0'}", + "Map(1) {Object => 'regexp0'}" } }, + { "map16", { "object", "map", "Map", "Map(1) {Object => 'uint8array0'}", + "Map(1) {Object => 'uint8array0'}" } }, + { "map15", { "object", "map", "Map", "Map(1) {Object => 'arraybuffer0'}", + "Map(1) {Object => 'arraybuffer0'}" } }, + { "map7", { "object", "map", "Map", "Map(1) {1 => 'number0'}", "Map(1) {1 => 'number0'}" } }, + { "map11", { "object", "map", "Map", "Map(1) {Object => 'array0'}", "Map(1) {Object => 'array0'}" } }, + { "map10", { "object", "map", "Map", "Map(1) {undefined => 'undefined0'}", + "Map(1) {undefined => 'undefined0'}" } }, + { "map9", { "object", "map", "Map", "Map(1) {Object => 'object0'}", "Map(1) {Object => 'object0'}" } }, + { "map17", { "object", "map", "Map", "Map(1) {Object => 'dataview0'}", "Map(1) {Object => 'dataview0'}" } }, + { "map6", { "object", "map", "Map", "Map(1) {Object => 'set0'}", "Map(1) {Object => 'set0'}" } }, + { "map19", { "object", "map", "Map", "Map(1) {Object => 'function0'}", "Map(1) {Object => 'function0'}" } }, + { "map12", { "object", "map", "Map", "Map(1) {Object => 'map3'}", "Map(1) {Object => 'map3'}" } }, + { "map3", { "object", "map", "Map", "Map(1) {NaN => 'NaN'}", "Map(1) {NaN => 'NaN'}" } }, + { "map2", { "object", "map", "Map", "Map(2) {1 => 'hello', 2 => 'world'}", + "Map(2) {1 => 'hello', 2 => 'world'}" } }, + { "map5", { "object", "map", "Map", "Map(4) {0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three'}", + "Map(4) {0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three'}" } }, + { "set4", { "object", "set", "Set", "Set(0)", "Set(0)" } }, + { "set2", { "object", "set", "Set", "Set(7) {'h', 'e', 'l', 'o', 'w', ...}", + "Set(7) {'h', 'e', 'l', 'o', 'w', ...}" } }, + { "set6", { "object", "set", "Set", "Set(0)", "Set(0)" } }, + { "set1", { "object", "set", "Set", "Set(1) {1}", "Set(1) {1}" } }, + { "set7", { "object", "set", "Set", "Set(0)", "Set(0)" } }, + { "set0", { "object", "set", "Set", "Set(0)", "Set(0)" } }, + { "set17", { "object", "set", "Set", "Set(1) {999}", "Set(1) {999}" } }, + { "set19", { "object", "set", "Set", "Set(0)", "Set(0)" } }, + { "set18", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "set12", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "set8", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "set15", { "object", "set", "Set", "Set(4) {0, 'hello', Object, 1}", "Set(4) {0, 'hello', Object, 1}" } }, + { "set13", { "object", "set", "Set", "Set(1) {Object}", "Set(1) {Object}" } }, + { "boolean5", { "object", "Object", "Boolean{[[PrimitiveValue]]: true}", + "Boolean{[[PrimitiveValue]]: true}" } }, + { "obj0", { "object", "Object", "Object", "Object" } }, + { "object1", { "object", "Object", "Object", "Object" } }, + { "object2", { "object", "Object", "Object", "Object" } }, + { "object3", { "object", "Object", "Object", "Object" } }, + { "object8", { "object", "Object", "Object", "Object" } }, + { "object9", { "object", "Object", "Object", "Object" } }, + { "object14", { "object", "Object", "Object", "Object" } }, + { "object16", { "object", "Object", "Uint8Array(24)", "Uint8Array(24)" } }, + { "object18", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "object5", { "object", "Object", "String{[[PrimitiveValue]]: helloworld}", + "String{[[PrimitiveValue]]: helloworld}" } }, + { "object7", { "object", "Object", "Number{[[PrimitiveValue]]: 1}", "Number{[[PrimitiveValue]]: 1}" } }, + { "object6", { "object", "map", "Map", "Map(0)", "Map(0)" } }, + { "object10", { "object", "array", "Array", "Array(2)", "Array(2)" } }, + { "object4", { "object", "set", "Set", "Set(0)", "Set(0)" } }, + { "object17", { "object", "dataview", "Dataview", "DataView(24)", "DataView(24)" } }, + { "object13", { "object", "regexp", "RegExp", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i" } }, + { "object15", { "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "ArrayBuffer(24)" } }, + { "bigint5", { "bigint", "9007199254740991n", "9007199254740991n" } }, + { "bigint20", { "bigint", "65535n", "65535n" } }, + { "bigint12", { "bigint", "999n", "999n" } }, + { "bigint0", { "bigint", "999n", "999n" } }, + { "bigint1", { "bigint", "9007199254740991n", "9007199254740991n" } }, + { "bigint2", { "bigint", "9007199254740991n", "9007199254740991n" } }, + { "bigint14", { "bigint", "888888888888888888888888888888888888888888888n", + "888888888888888888888888888888888888888888888n" } }, + { "bigint9", { "bigint", "-9007199254739992n", "-9007199254739992n" } }, + { "bigint16", { "bigint", "0n", "0n" } }, + { "bigint17", { "bigint", "0n", "0n" } }, + { "bigint11", { "bigint", "0n", "0n" } }, + { "bigint6", { "bigint", "9007199254740991n", "9007199254740991n" } }, + { "bigint18", { "bigint", "122999999999999994846185700645503654167417192448n", + "122999999999999994846185700645503654167417192448n" } }, + { "bigint19", { "bigint", "1234567n", "1234567n" } }, + { "bigint7", { "bigint", "999n", "999n" } }, + { "bigint13", { "bigint", "10000000000n", "10000000000n" } }, + { "bigint10", { "bigint", "8998192055486250009n", "8998192055486250009n" } }, + { "bigint15", { "bigint", "16383n", "16383n" } }, + { "bigint8", { "bigint", "9007199254741990n", "9007199254741990n" } }, + { "bigint3", { "bigint", "9007199254740991n", "9007199254740991n" } }, + { "bigint4", { "bigint", "9007199254740991n", "9007199254740991n" } }, + { "sharedarraybuffer0", { "object", "Object", "SharedArrayBuffer(32)", "SharedArrayBuffer(32)" } }, + { "weakref0", { "object", "Object", "WeakRef {}", "WeakRef {}" } }, + { "revoke", { "function", "Function", "function ( { [native code] }", "function ( { [native code] }" } }, + { "proxy", { "object", "proxy", "Object", "Proxy", "Proxy" } }, + { "proxy1", { "object", "proxy", "Object", "Proxy", "Proxy" } }, + { "proxy2", { "object", "Object", "Object", "Object" } }, + { "handler", { "object", "Object", "Object", "Object" } }, + { "target", { "object", "Object", "Object", "Object" } }, + { "uint8array0", { "object", "Object", "Uint8Array(24)", "Uint8Array(24)" } }, + { "typedarray0", { "object", "Object", "Uint8Array(0)", "Uint8Array(0)" } }, + { "iterator0", { "function", "Function", "function [Symbol.iterator]( { [native code] }", + "function [Symbol.iterator]( { [native code] }" } }, + { "undefined0", { "undefined" } }, + }; }; -std::unique_ptr GetJsVariableFirstTest() +std::unique_ptr GetJsVariableFirstTest() { return std::make_unique(); } } // namespace panda::ecmascript::tooling::test -#endif // ECMASCRIPT_TOOLING_TEST_UTILS_TESTCASES_JS_VARIABLE_TEST_H +#endif // ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_VARIABLE_FIRST_TEST_H diff --git a/tooling/test/testcases/js_variable_second_test.h b/tooling/test/testcases/js_variable_second_test.h index d5835b11..a63bc5d0 100644 --- a/tooling/test/testcases/js_variable_second_test.h +++ b/tooling/test/testcases/js_variable_second_test.h @@ -13,403 +13,232 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_TOOLING_TEST_UTILS_TESTCASES_JS_VARIABLE_SECOND_TEST_H -#define ECMASCRIPT_TOOLING_TEST_UTILS_TESTCASES_JS_VARIABLE_SECOND_TEST_H +#ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_VARIABLE_SECOND_TEST_H +#define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_VARIABLE_SECOND_TEST_H -#include "test/utils/test_util.h" +#include "tooling/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { -class JsVariableSecondTest : public TestEvents { +class JsVariableSecondTest : public TestActions { public: JsVariableSecondTest() { - breakpoint = [this](const JSPtLocation &location) { - ASSERT_TRUE(location.GetMethodId().IsValid()); - ASSERT_LOCATION_EQ(location, location_); - ++breakpointCounter_; - debugger_->NotifyPaused(location, PauseReason::INSTRUMENTATION); - TestUtil::SuspendUntilContinue(DebugEvent::BREAKPOINT, location); - return true; - }; - - loadModule = [this](std::string_view moduleName) { - std::string panfaFile = DEBUGGER_ABC_DIR "variable_second.abc"; - std::string sourceFile = DEBUGGER_JS_DIR "variable_second.js"; - static_cast(channel_)->Initial(vm_, runtime_); - runtime_->Enable(); - // 125: breakpointer line - location_ = TestUtil::GetLocation(sourceFile.c_str(), 125, 0, panfaFile.c_str()); - ASSERT_TRUE(location_.GetMethodId().IsValid()); - TestUtil::SuspendUntilContinue(DebugEvent::LOAD_MODULE); - ASSERT_EQ(moduleName, panfaFile); - ASSERT_TRUE(debugger_->NotifyScriptParsed(0, panfaFile)); - auto condFuncRef = FunctionRef::Undefined(vm_); - auto ret = debugInterface_->SetBreakpoint(location_, condFuncRef); - ASSERT_TRUE(ret); - return true; - }; - - scenario = [this]() { - TestUtil::WaitForLoadModule(); - TestUtil::Continue(); - TestUtil::WaitForBreakpoint(location_); - TestUtil::Continue(); - auto ret = debugInterface_->RemoveBreakpoint(location_); - ASSERT_TRUE(ret); - ASSERT_EXITED(); - return true; - }; + testAction = { + {SocketAction::SEND, "enable"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + {SocketAction::SEND, "runtime-enable"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + {SocketAction::SEND, "run"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + // load variable_second.js + {SocketAction::RECV, "Debugger.scriptParsed", ActionRule::STRING_CONTAIN}, + // break on start + {SocketAction::RECV, "Debugger.paused", ActionRule::STRING_CONTAIN}, + // set breakpoint + {SocketAction::SEND, "b " DEBUGGER_JS_DIR "variable_second.js 126"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + + {SocketAction::SEND, "resume"}, + {SocketAction::RECV, "Debugger.resumed", ActionRule::STRING_CONTAIN}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, + {SocketAction::RECV, "Debugger.paused", ActionRule::CUSTOM_RULE, [this] (auto recv, auto, auto) -> bool { + std::unique_ptr json = PtJson::Parse(recv); + Result ret; + std::string method; + ret = json->GetString("method", &method); + if (ret != Result::SUCCESS || method != "Debugger.paused") { + return false; + } - vmDeath = [this]() { - ASSERT_EQ(breakpointCounter_, 1U); // 1: break point counter - return true; - }; + std::unique_ptr params = nullptr; + ret = json->GetObject("params", ¶ms); + if (ret != Result::SUCCESS) { + return false; + } - channel_ = new JsVariableSecondTestChannel(); - } + std::unique_ptr hitBreakpoints = nullptr; + ret = params->GetArray("hitBreakpoints", &hitBreakpoints); + if (ret != Result::SUCCESS) { + return false; + } - std::pair GetEntryPoint() override - { - std::string panfaFile = DEBUGGER_ABC_DIR "variable_second.abc"; - return {panfaFile, entryPoint_}; - } - ~JsVariableSecondTest() - { - delete channel_; - channel_ = nullptr; - } + std::string breakpoint; + breakpoint = hitBreakpoints->Get(0)->GetString(); + if (ret != Result::SUCCESS || breakpoint.find(sourceFile_) == std::string::npos || + breakpoint.find("125") == std::string::npos) { + return false; + } -private: - class JsVariableSecondTestChannel : public TestChannel { - public: - JsVariableSecondTestChannel() = default; - ~JsVariableSecondTestChannel() = default; - void Initial(const EcmaVM *vm, RuntimeImpl *runtime) - { - vm_ = vm; - runtime_ = runtime; - } + DebuggerClient debuggerClient(0); + debuggerClient.PausedReply(std::move(json)); + return true; + }}, - void SendNotification(const PtBaseEvents &events) override - { - const static std::vector> eventList = { - [](const PtBaseEvents &events) -> bool { - std::string sourceFile = DEBUGGER_JS_DIR "variable_second.js"; - auto parsed = static_cast(&events); - std::string str = parsed->ToJson()->Stringify(); - std::cout << "JsVariableSecondTestChannel: SendNotification 0:\n" << str << std::endl; + {SocketAction::SEND, "p"}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, [this] (auto recv, auto, auto) -> bool { + std::unique_ptr json = PtJson::Parse(recv); - ASSERT_EQ(parsed->GetName(), "Debugger.scriptParsed"); - ASSERT_EQ(parsed->GetUrl(), sourceFile); - return true; - }, - [this](const PtBaseEvents &events) -> bool { - auto paused = static_cast(&events); - std::string str = paused->ToJson()->Stringify(); - std::cout << "JsVariableSecondTestChannel: SendNotification 1:\n" << str << std::endl; + int id; + Result ret = json->GetInt("id", &id); + if (ret != Result::SUCCESS) { + return false; + } - ASSERT_EQ(paused->GetName(), "Debugger.paused"); - auto frame = paused->GetCallFrames()->at(0).get(); - ASSERT_EQ(frame->GetFunctionName(), "foo"); - auto scopes = frame->GetScopeChain(); - ASSERT_EQ(scopes->size(), 2U); // 2: contain local and global - for (uint32_t i = 0; i < scopes->size(); i++) { - auto scope = scopes->at(i).get(); - if (scope->GetType() != Scope::Type::Local()) { - continue; - } - auto localId = scope->GetObject()->GetObjectId(); - GetPropertiesParams params; - params.SetObjectId(localId).SetOwnProperties(true); - std::vector> outPropertyDesc; - runtime_->GetProperties(params, &outPropertyDesc, {}, {}, {}); - for (const auto &property : outPropertyDesc) { - std::cout << "=====================================" << std::endl; - std::cout << property->GetName() << std::endl; - auto value = property->GetValue(); - std::vector infos; - PushValueInfo(value, infos); - if (value->GetType() == RemoteObject::TypeName::Object) { - std::vector> outPropertyDescInner; - ASSERT_TRUE(value->HasObjectId()); - params.SetObjectId(value->GetObjectId()).SetOwnProperties(true); - runtime_->GetProperties(params, &outPropertyDescInner, {}, {}, {}); - if (outPropertyDescInner.size() == 0) { - infos.push_back("none"); - } - for (const auto &propertyInner : outPropertyDescInner) { - std::cout << "###########################################" << std::endl; - std::cout << propertyInner->GetName() << std::endl; - infos.push_back(propertyInner->GetName()); - auto innerValue = propertyInner->GetValue(); - PushValueInfo(innerValue, infos); - } - } - ASSERT_EQ(infos.size(), variableMap_.at(property->GetName()).size()); - for (uint32_t j = 0; j < infos.size(); j++) { - ASSERT_EQ(infos[j], variableMap_.at(property->GetName())[j]); - } - } - } - return true; + std::unique_ptr result; + ret = json->GetObject("result", &result); + if (ret != Result::SUCCESS) { + return false; } - }; - ASSERT_TRUE(eventList[index_](events)); - index_++; - } + std::unique_ptr innerResult; + ret = result->GetArray("result", &innerResult); + if (ret != Result::SUCCESS) { + return false; + } - private: - NO_COPY_SEMANTIC(JsVariableSecondTestChannel); - NO_MOVE_SEMANTIC(JsVariableSecondTestChannel); + if (!TestUtil::ComparePropertyDescriptors(innerResult, variableMap_)) { + return false; + } - void PushValueInfo(RemoteObject *value, std::vector &infos) - { - std::cout << "type: " << value->GetType() << std::endl; - infos.push_back(value->GetType()); - if (value->HasObjectId()) { - std::cout << "id: " << value->GetObjectId() << std::endl; - } - if (value->HasSubType()) { - std::cout << "sub type: " << value->GetSubType() << std::endl; - infos.push_back(value->GetSubType()); - } - if (value->HasClassName()) { - std::cout << "class name: " << value->GetClassName() << std::endl; - infos.push_back(value->GetClassName()); - } - if (value->HasDescription()) { - std::cout << "desc: " << value->GetDescription() << std::endl; - infos.push_back(value->GetDescription()); - } - if (value->HasValue()) { - std::cout << "type: " << - value->GetValue()->Typeof(vm_)->ToString() << std::endl; - std::cout << "tostring: " << - value->GetValue()->ToString(vm_)->ToString() << std::endl; - infos.push_back(value->GetValue()->ToString(vm_)->ToString()); - } - } + RuntimeClient runtimeClient(0); + runtimeClient.HandleGetProperties(std::move(json), id); + return true; + }}, - /* - * Expect map type: map - * value list (optional): - * type - * subType - * className - * description - * value tostring - * - * if is object value, will push back key and value. - * - * for example: - * var abc = 1 - * { "abc", { "number", "1", "1" } } - * var obj = { "key": "2" } - * { "obj0", { "object", "Object", "Object", "[object Object]", "key", "string", "2", "2" } } - */ - const std::map> variableMap_ = { - { "nop", { "undefined" } }, - { "foo", { "function", "Function", "function foo( { [js code] }", - "Cannot get source code of funtion"} }, - { "string0", { "string", "helloworld", "helloworld" } }, - { "boolean0", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", "false", "[[PrimitiveValue]]", - "boolean", "false", "false" } }, - { "number0", { "number", "1", "1" } }, - { "obj0", { "object", "Object", "Object", "[object Object]", - "key0", "string", "value0", "value0", - "key1", "number", "100", "100" } }, - { "arraybuffer0", { "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "[object ArrayBuffer]", - "[[Int8Array]]", "object", "Object", "Int8Array(24)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint8Array]]", "object", - "Object", "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Uint8ClampedArray]]", "object", "Object", "Object", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Int16Array]]", "object", - "Object", "Int16Array(12)", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint16Array]]", "object", - "Object", "Object", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", - "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Object", - "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Object", "0,0,0,0,0,0", - "[[Float64Array]]", "object", "Object", "Object", "0,0,0", "[[BigInt64Array]]", - "object", "Object", "Object", "0,0,0", "[[BigUint64Array]]", "object", "Object", - "Object", "0,0,0" } }, - { "function0", { "function", "Function", "function function0( { [js code] }", - "Cannot get source code of funtion" } }, - { "generator0", { "function", "Generator", "function* generator0( { [js code] }", - "Cannot get source code of funtion" } }, - { "map0", { "object", "map", "Map", "Map(0)", "[object Map]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "set0", { "object", "set", "Set", "Set(0)", "[object Set]", "size", "number", "0", "0", "[[Entries]]", - "object", "array", "Array", "Array(0)", "" } }, - { "undefined0", { "undefined" } }, - { "array0", { "object", "array", "Array", "Array(2)", "Apple,Banana", "0", "string", "Apple", "Apple", - "1", "string", "Banana", "Banana", "length", "number", "2", "2" } }, - { "regexp0", { "object", "regexp", "RegExp", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i", "global", "boolean", - "false", "false", "ignoreCase", "boolean", "true", "true", "multiline", "boolean", "false", - "false", "dotAll", "boolean", "false", "false", "hasIndices", "boolean", "false", "false", - "unicode", "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", - "string", "i", "i", "source", "string", "^\\d+\\.\\d+$", "^\\d+\\.\\d+$", "lastIndex", - "number", "0", "0" } }, - { "uint8array0", { "object", "Object", "Uint8Array(24)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "0", "number", "0", "0", - "1", "number", "0", "0", "2", "number", "0", "0", "3", "number", "0", "0", "4", - "number", "0", "0", "5", "number", "0", "0", "6", "number", "0", "0", "7", - "number", "0", "0", "8", "number", "0", "0", "9", "number", "0", "0", "10", - "number", "0", "0", "11", "number", "0", "0", "12", "number", "0", "0", "13", - "number", "0", "0", "14", "number", "0", "0", "15", "number", "0", "0", "16", - "number", "0", "0", "17", "number", "0", "0", "18", "number", "0", "0", "19", - "number", "0", "0", "20", "number", "0", "0", "21", "number", "0", "0", "22", - "number", "0", "0", "23", "number", "0", "0" } }, - { "dataview0", { "object", "dataview", "Dataview", "DataView(24)", "[object DataView]", "buffer", - "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "[object ArrayBuffer]", - "byteLength", "number", "24", "24", "byteOffset", "number", "0", "0" } }, - { "bigint0", { "bigint", "999n", "999" } }, - { "typedarray0", { "object", "Object", "Uint8Array(0)", "", "none" } }, - { "sharedarraybuffer0", { "object", "Object", "SharedArrayBuffer(32)", "[object SharedArrayBuffer]", - "[[Int8Array]]", "object", "Object", "Int8Array(32)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Uint8Array]]", "object", "Object", "Uint8Array(32)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Int16Array]]", "object", "Object", "Int16Array(16)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", - "Int32Array(8)", "0,0,0,0,0,0,0,0", "[[ArrayBufferByteLength]]", "number", "32", - "32", "byteLength", "number", "32", "32" } }, - { "weakref0", { "object", "Object", "WeakRef {}", "[object WeakRef]", "none" } }, - { "iterator0", { "function", "Function", "function [Symbol.iterator]( { [native code] }", - "function [Symbol.iterator]() { [native code] }" } }, - { "array1", { "object", "array", "Array", "Array(3)", "banana,apple,peach", "0", "string", "banana", - "banana", "1", "string", "apple", "apple", "2", "string", "peach", "peach", "length", - "number", "3", "3" } }, - { "array2", { "object", "array", "Array", "Array(3)", "banana,apple,peach", "0", "string", "banana", - "banana", "1", "string", "apple", "apple", "2", "string", "peach", "peach", "length", - "number", "3", "3" } }, - { "array3", { "object", "array", "Array", "Array(1)", "apple", "0", "string", "apple", "apple", - "length", "number", "1", "1" } }, - { "array4", { "string", "banana", "banana" } }, - { "array5", { "object", "array", "Array", "Array(1)", "", "length", "number", "1", "1" } }, - { "array6", { "object", "array", "Array", "Array(1)", "helloworld", "0", "string", "helloworld", - "helloworld", "length", "number", "1", "1" } }, - { "array7", { "object", "array", "Array", "Array(1)", "false", "0", "object", "Object", - "Boolean{[[PrimitiveValue]]: false}", "false", "length", "number", "1", "1" } }, - { "array8", { "object", "array", "Array", "Array(1)", "[object Object]", "0", "object", "Object", - "Object", "[object Object]", "length", "number", "1", "1" } }, - { "array9", { "object", "array", "Array", "Array(1)", "Cannot get source code of funtion", "0", "function", - "Function", "function function0( { [js code] }", "Cannot get source code of funtion", - "length", "number", "1", "1" } }, - { "array10", { "object", "array", "Array", "Array(1)", "[object Map]", "0", "object", "map", "Map", - "Map(0)", "[object Map]", "length", "number", "1", "1" } }, - { "array11", { "object", "array", "Array", "Array(1)", "[object Set]", "0", "object", "set", "Set", - "Set(0)", "[object Set]", "length", "number", "1", "1" } }, - { "array12", { "object", "array", "Array", "Array(1)", "", "0", "undefined", "length", "number", - "1", "1" } }, - { "array13", { "object", "array", "Array", "Array(1)", "Apple,Banana", "0", "object", "array", "Array", - "Array(2)", "Apple,Banana", "length", "number", "1", "1" } }, - { "array14", { "object", "array", "Array", "Array(1)", "Cannot get source code of funtion", "0", - "function", "Generator", "function* generator0( { [js code] }", - "Cannot get source code of funtion", "length", "number", "1", "1" } }, - { "array15", { "object", "array", "Array", "Array(1)", "/^\\d+\\.\\d+$/i", "0", "object", "regexp", - "RegExp", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i", "length", "number", "1", "1" } }, - { "array16", { "object", "array", "Array", "Array(1)", "[object ArrayBuffer]", "0", "object", - "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "[object ArrayBuffer]", - "length", "number", "1", "1" } }, - { "array17", { "object", "array", "Array", "Array(1)", - "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "0", "object", "Object", - "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "length", "number", "1", "1" } }, - { "array18", { "object", "array", "Array", "Array(1)", "[object DataView]", "0", "object", "dataview", - "Dataview", "DataView(24)", "[object DataView]", "length", "number", "1", "1" } }, - { "array19", { "object", "array", "Array", "Array(1)", "999", "0", "bigint", "999n", "999", "length", - "number", "1", "1" } }, - { "array20", { "object", "array", "Array", "Array(3)", "banana,apple,peach", "0", "string", "banana", - "banana", "1", "string", "apple", "apple", "2", "string", "peach", "peach", "length", - "number", "3", "3" } }, - { "array21", { "string", "banana", "banana" } }, - { "typedarray1", { "object", "Object", "Int8Array(0)", "", "none" } }, - { "typedarray2", { "object", "Object", "Object", "", "none" } }, - { "typedarray3", { "object", "Object", "Int16Array(0)", "", "none" } }, - { "typedarray4", { "object", "Object", "Object", "", "none" } }, - { "typedarray5", { "object", "Object", "Int32Array(0)", "", "none" } }, - { "typedarray6", { "object", "Object", "Object", "", "none" } }, - { "typedarray7", { "object", "Object", "Object", "", "none" } }, - { "typedarray8", { "object", "Object", "Object", "", "none" } }, - { "typedarray9", { "object", "Object", "Object", "", "none" } }, - { "typedarray10", { "object", "Object", "Object", "", "none" } }, - { "typedarray11", { "object", "Object", "Uint8Array(1)", "0", "0", "number", "0", "0" } }, - { "iterator1", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator3", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator2", { "function", "Function", "function entries( { [native code] }", - "function entries() { [native code] }" } }, - { "iterator4", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator5", { "function", "Function", "function [Symbol.iterator]( { [native code] }", - "function [Symbol.iterator]() { [native code] }" } }, - { "iterator6", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator7", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator8", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator9", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator10", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator11", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator12", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator13", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator14", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator15", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator16", { "function", "Function", "function values( { [native code] }", - "function values() { [native code] }" } }, - { "iterator17", { "undefined" } }, - { "iterator18", { "undefined" } }, - { "iterator19", { "undefined" } }, - { "weakMap0", { "object", "weakmap", "Weakmap", "WeakMap(0)", "[object WeakMap]", - "[[Entries]]", "object", "array", "Array", "Array(0)", "" } }, - { "p1", { "object", "Object", "Number{[[PrimitiveValue]]: 1}", "1", "[[PrimitiveValue]]", "number", - "1", "1" } }, - { "p2", { "object", "Object", "Number{[[PrimitiveValue]]: 2}", "2", "[[PrimitiveValue]]", "number", - "2", "2" } }, - { "weakMap1", { "object", "weakmap", "Weakmap", "WeakMap(2) {Object => 'hello', Object => 'world'}", - "[object WeakMap]", "[[Entries]]", "object", "array", - "Array", "Array(2)", "[object Object],[object Object]" } }, - { "weakMap2", { "object", "weakmap", "Weakmap", "WeakMap(0)", "[object WeakMap]", "[[Entries]]", - "object", "array", "Array", "Array(0)", "", "0", "string", "hello", "hello" } }, - { "weakMap3", { "object", "weakmap", "Weakmap", "WeakMap(1) {Object => 'weakMap0'}", "[object WeakMap]", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "weakMap4", { "object", "weakmap", "Weakmap", "WeakMap(2) {Object => 37, Object => 'azerty'}", - "[object WeakMap]", "[[Entries]]", "object", "array", - "Array", "Array(2)", "[object Object],[object Object]" } }, - { "weakMap5", { "object", "weakmap", "Weakmap", "WeakMap(1) {Object => undefined}", "[object WeakMap]", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "weakSet0", { "object", "weakset", "Weakset", "WeakSet(0)", "[object WeakSet]", - "[[Entries]]", "object", "array", "Array", "Array(0)", "" } }, - { "weakSet1", { "object", "weakset", "Weakset", "WeakSet(1) {Object}", "[object WeakSet]", - "[[Entries]]", "object", "array", "Array", "Array(1)", "[object Object]" } }, - { "weakSet2", { "object", "weakset", "Weakset", "WeakSet(2) {Object, Object}", "[object WeakSet]", - "[[Entries]]", "object", "array", "Array", "Array(2)", - "[object Object],[object Object]" } }, + // reply success and run + {SocketAction::SEND, "success"}, + {SocketAction::SEND, "resume"}, + {SocketAction::RECV, "Debugger.resumed", ActionRule::STRING_CONTAIN}, + {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, }; + } - int32_t index_ {0}; - const EcmaVM *vm_ {nullptr}; - RuntimeImpl *runtime_ {nullptr}; - }; + std::pair GetEntryPoint() override + { + return {pandaFile_, entryPoint_}; + } + ~JsVariableSecondTest() = default; +private: + std::string pandaFile_ = DEBUGGER_ABC_DIR "variable_second.abc"; + std::string sourceFile_ = DEBUGGER_JS_DIR "variable_second.js"; std::string entryPoint_ = "_GLOBAL::func_main_0"; - JSPtLocation location_ {nullptr, JSPtLocation::EntityId(0), 0}; - size_t breakpointCounter_ = 0; + + const std::map> variableMap_ = { + { "array123", { "object", "array", "Array", "Array(2)", "Array(2)" } }, + { "bigint123", { "bigint", "999n", "999n" } }, + { "iterator123", { "function", "Function", "function [Symbol.iterator]( { [native code] }", + "function [Symbol.iterator]( { [native code] }" } }, + { "iterator1", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator2", { "function", "Function", "function entries( { [native code] }", + "function entries( { [native code] }" } }, + { "iterator3", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator4", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator5", { "function", "Function", "function [Symbol.iterator]( { [native code] }", + "function [Symbol.iterator]( { [native code] }" } }, + { "iterator6", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator7", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator8", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator9", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator10", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator11", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator12", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator13", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator14", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator15", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator16", { "function", "Function", "function values( { [native code] }", + "function values( { [native code] }" } }, + { "iterator17", { "undefined" } }, + { "iterator19", { "undefined" } }, + { "obj123", { "object", "Object", "Object", "Object" } }, + { "foo123", { "function", "Function", "function foo123( { [js code] }", "function foo123( { [js code] }" } }, + { "array1", { "object", "array", "Array", "Array(3)", "Array(3)" } }, + { "array2", { "object", "array", "Array", "Array(3)", "Array(3)" } }, + { "array3", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array4", { "string", "banana", "banana" } }, + { "array5", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array6", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array7", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array8", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array9", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array10", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array11", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array12", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array13", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array14", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array15", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array16", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array17", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array18", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array19", { "object", "array", "Array", "Array(1)", "Array(1)" } }, + { "array20", { "object", "array", "Array", "Array(3)", "Array(3)" } }, + { "array21", { "string", "banana", "banana" } }, + { "undefined123", { "undefined" } }, + { "nop123", { "undefined" } }, + { "weakset123", { "object", "weakset", "Weakset", "WeakSet(0)", "WeakSet(0)" } }, + { "weakSet1", { "object", "weakset", "Weakset", "WeakSet(1) {Object}", "WeakSet(1) {Object}" } }, + { "weakSet2", { "object", "weakset", "Weakset", "WeakSet(2) {Object, Object}", + "WeakSet(2) {Object, Object}" } }, + { "weakmap123", { "object", "weakmap", "Weakmap", "WeakMap(0)", "WeakMap(0)" } }, + { "weakMap1", { "object", "weakmap", "Weakmap", "WeakMap(2) {Object => 'hello', Object => 'world'}", + "WeakMap(2) {Object => 'hello', Object => 'world'}" } }, + { "weakMap2", { "object", "weakmap", "Weakmap", "WeakMap(0)", "WeakMap(0)" } }, + { "weakMap3", { "object", "weakmap", "Weakmap", "WeakMap(1) {Object => 'weakmap123'}", + "WeakMap(1) {Object => 'weakmap123'}" } }, + { "weakMap4", { "object", "weakmap", "Weakmap", "WeakMap(2) {Object => 37, Object => 'azerty'}", + "WeakMap(2) {Object => 37, Object => 'azerty'}" } }, + { "weakMap5", { "object", "weakmap", "Weakmap", "WeakMap(1) {Object => undefined}", + "WeakMap(1) {Object => undefined}" } }, + { "uint8array123", { "object", "Object", "Uint8Array(24)", "Uint8Array(24)" } }, + { "string123", { "string", "helloworld", "helloworld" } }, + { "dataview123", { "object", "dataview", "Dataview", "DataView(24)", "DataView(24)" } }, + { "typedarray123", { "object", "Object", "Uint8Array(0)", "Uint8Array(0)" } }, + { "typedarray1", { "object", "Object", "Int8Array(0)", "Int8Array(0)" } }, + { "typedarray2", { "object", "Object", "Object", "Object" } }, + { "typedarray3", { "object", "Object", "Int16Array(0)", "Int16Array(0)" } }, + { "typedarray4", { "object", "Object", "Object", "Object" } }, + { "typedarray5", { "object", "Object", "Int32Array(0)", "Int32Array(0)" } }, + { "typedarray6", { "object", "Object", "Object", "Object" } }, + { "typedarray7", { "object", "Object", "Object", "Object" } }, + { "typedarray8", { "object", "Object", "Object", "Object" } }, + { "typedarray9", { "object", "Object", "Object", "Object" } }, + { "typedarray10", { "object", "Object", "Object", "Object" } }, + { "typedarray11", { "object", "Object", "Uint8Array(1)", "Uint8Array(1)" } }, + { "generator123", { "function", "Generator", "function* generator123( { [js code] }", + "function* generator123( { [js code] }" } }, + { "number123", { "number", "1", "1" } }, + { "boolean123", { "object", "Object", "Boolean{[[PrimitiveValue]]: false}", + "Boolean{[[PrimitiveValue]]: false}" } }, + { "p1", { "object", "Object", "Number{[[PrimitiveValue]]: 1}", "Number{[[PrimitiveValue]]: 1}" } }, + { "p2", { "object", "Object", "Number{[[PrimitiveValue]]: 2}", "Number{[[PrimitiveValue]]: 2}" } }, + { "set123", { "object", "set", "Set", "Set(0)", "Set(0)" } }, + { "regexp123", { "object", "regexp", "RegExp", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i" } }, + { "function123", { "function", "Function", "function function123( { [js code] }", + "function function123( { [js code] }" } }, + { "arraybuffer123", { "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "ArrayBuffer(24)" } }, + { "map123", { "object", "map", "Map", "Map(0)", "Map(0)" } }, + { "sharedarraybuffer123", { "object", "Object", "SharedArrayBuffer(32)", "SharedArrayBuffer(32)" } }, + { "weakref123", { "object", "Object", "WeakRef {}", "WeakRef {}" } }, + }; }; -std::unique_ptr GetJsVariableSecondTest() +std::unique_ptr GetJsVariableSecondTest() { return std::make_unique(); } } // namespace panda::ecmascript::tooling::test -#endif // ECMASCRIPT_TOOLING_TEST_UTILS_TESTCASES_JS_VARIABLE_TEST_H +#endif // ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_VARIABLE_SECOND_TEST_H diff --git a/tooling/test/utils/test_list.cpp b/tooling/test/utils/test_list.cpp index 0a4e64bf..16f34d6c 100644 --- a/tooling/test/utils/test_list.cpp +++ b/tooling/test/utils/test_list.cpp @@ -25,8 +25,6 @@ #include "test/testcases/js_step_out_test.h" #include "test/testcases/js_syntax_exception_test.h" #include "test/testcases/js_throw_exception_test.h" -#include "test/testcases/js_variable_first_test.h" -#include "test/testcases/js_variable_second_test.h" #include "test/testcases/js_dropframe_test.h" namespace panda::ecmascript::tooling::test { @@ -43,8 +41,6 @@ static void RegisterTests() TestUtil::RegisterTest("JsStepOverTest", GetJsStepOverTest()); TestUtil::RegisterTest("JsStepOutTest", GetJsStepOutTest()); TestUtil::RegisterTest("JSDropFrameTest", GetJsDropFrameTest()); - TestUtil::RegisterTest("JsVariableFirstTest", GetJsVariableFirstTest()); - TestUtil::RegisterTest("JsVariableSecondTest", GetJsVariableSecondTest()); } std::vector GetTestList() -- Gitee