• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 <gtest/gtest.h>
17 
18 #include "libabckit/include/c/extensions/arkts/metadata_arkts.h"
19 #include "helpers/helpers.h"
20 #include "metadata_inspect_impl.h"
21 
22 namespace {
23 auto g_impl = AbckitGetApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
24 auto g_implArkI = AbckitGetArktsInspectApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
25 auto g_implArkM = AbckitGetArktsModifyApiImpl(ABCKIT_VERSION_RELEASE_1_0_0);
26 }  // namespace
27 
28 namespace libabckit::test {
29 
30 class AbckitRegressionTestCAPI : public ::testing::Test {};
31 
32 // Test: test-kind=regression, abc-kind=ArkTS1, category=positive, extension=cpp
TEST_F(AbckitRegressionTestCAPI,LibAbcKitTestIssueIB1YEI)33 TEST_F(AbckitRegressionTestCAPI, LibAbcKitTestIssueIB1YEI)
34 {
35     std::string inputPath = ABCKIT_ABC_DIR "regression/issue_IB1YEI/issue_IB1YEI.abc";
36     struct AbckitArktsV1ExternalModuleCreateParams params {
37         "new_module"
38     };
39 
40     AbckitFile *file = g_impl->openAbc(inputPath.c_str(), inputPath.size());
41     ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
42     auto newModule = g_implArkM->fileAddExternalModuleArktsV1(file, &params);
43     ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
44     auto arktsModule = g_implArkI->arktsModuleToCoreModule(newModule);
45     ASSERT_EQ(g_impl->getLastError(), ABCKIT_STATUS_NO_ERROR);
46     EXPECT_NE(arktsModule, nullptr);
47 
48     g_impl->closeFile(file);
49 }
50 
51 }  // namespace libabckit::test
52