1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "test/utils/test_list.h" 17 18#include "test/utils/test_util.h" 19 20// testcase list 21#include "test/testcases/js_range_error_test.h" 22#include "test/testcases/js_single_step_test.h" 23#include "test/testcases/js_step_into_test.h" 24#include "test/testcases/js_step_over_test.h" 25#include "test/testcases/js_step_out_test.h" 26#include "test/testcases/js_syntax_exception_test.h" 27#include "test/testcases/js_throw_exception_test.h" 28#include "test/testcases/js_variable_first_test.h" 29#include "test/testcases/js_variable_second_test.h" 30#include "test/testcases/js_dropframe_test.h" 31 32namespace panda::ecmascript::tooling::test { 33static std::string g_currentTestName = ""; 34 35static void RegisterTests() 36{ 37 // Register testcases 38 TestUtil::RegisterTest("JsSingleStepTest", GetJsSingleStepTest()); 39 TestUtil::RegisterTest("JsRangeErrorTest", GetJsRangeErrorTest()); 40 TestUtil::RegisterTest("JsSyntaxExceptionTest", GetJsSyntaxExceptionTest()); 41 TestUtil::RegisterTest("JsThrowExceptionTest", GetJsThrowExceptionTest()); 42 TestUtil::RegisterTest("JsStepIntoTest", GetJsStepIntoTest()); 43 TestUtil::RegisterTest("JsStepOverTest", GetJsStepOverTest()); 44 TestUtil::RegisterTest("JsStepOutTest", GetJsStepOutTest()); 45 TestUtil::RegisterTest("JSDropFrameTest", GetJsDropFrameTest()); 46 TestUtil::RegisterTest("JsVariableFirstTest", GetJsVariableFirstTest()); 47 TestUtil::RegisterTest("JsVariableSecondTest", GetJsVariableSecondTest()); 48} 49 50std::vector<const char *> GetTestList() 51{ 52 RegisterTests(); 53 std::vector<const char *> res; 54 55 auto &tests = TestUtil::GetTests(); 56 for (const auto &entry : tests) { 57 res.push_back(entry.first.c_str()); 58 } 59 return res; 60} 61 62void SetCurrentTestName(const std::string &testName) 63{ 64 g_currentTestName = testName; 65} 66 67std::string GetCurrentTestName() 68{ 69 return g_currentTestName; 70} 71 72std::pair<std::string, std::string> GetTestEntryPoint(const std::string &testName) 73{ 74 return TestUtil::GetTest(testName)->GetEntryPoint(); 75} 76} // namespace panda::ecmascript::tooling::test 77