Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
adc54128
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
adc54128
编写于
9月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9933 ArkTs整改挑单monthly分支
Merge pull request !9933 from huyunhui/cherry-pick-1693280731
上级
ff492cc8
a61931c1
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
164 addition
and
2 deletion
+164
-2
arkcompiler/esmodule/esmodule_entry/entry/src/main/ets/test/DynamicImport.ets
.../esmodule_entry/entry/src/main/ets/test/DynamicImport.ets
+45
-0
arkcompiler/esmodule/esmodule_entry/entry/src/main/ets/test/List.test.ets
...dule/esmodule_entry/entry/src/main/ets/test/List.test.ets
+2
-0
arkcompiler/esmodule/esmodule_ohostest/entry/oh-package.json5
...ompiler/esmodule/esmodule_ohostest/entry/oh-package.json5
+4
-2
arkcompiler/esmodule/esmodule_ohostest/entry/src/ohosTest/cpp/CMakeLists.txt
...e/esmodule_ohostest/entry/src/ohosTest/cpp/CMakeLists.txt
+11
-0
arkcompiler/esmodule/esmodule_ohostest/entry/src/ohosTest/cpp/hello.cpp
...module/esmodule_ohostest/entry/src/ohosTest/cpp/hello.cpp
+67
-0
arkcompiler/esmodule/esmodule_ohostest/entry/src/ohosTest/cpp/types/libentry/index.d.ts
...ohostest/entry/src/ohosTest/cpp/types/libentry/index.d.ts
+15
-0
arkcompiler/esmodule/esmodule_ohostest/entry/src/ohosTest/cpp/types/libentry/oh-package.json5
...st/entry/src/ohosTest/cpp/types/libentry/oh-package.json5
+20
-0
未找到文件。
arkcompiler/esmodule/esmodule_entry/entry/src/main/ets/test/DynamicImport.ets
0 → 100644
浏览文件 @
adc54128
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from "@ohos/hypium"
export default function dynamicImport() {
describe("DynamicImportTest", async () => {
it('importHar', 0, async () => {
let lib = await import('har')
expect(lib.add(2, 3)).assertEqual(5)
})
it('importRelative', 0, async () => {
let lib = await import('./test')
expect(lib.add(2, 3)).assertEqual(5)
expect(lib.default).assertEqual('test')
})
it('importOhpm', 0, async () => {
let lib = await import('leap-year')
expect(lib.default(2000)).assertEqual(true)
})
it('importSystemInternal', 0, async () => {
let lib = await import('@ohos.hilog')
lib.default.info(0x0000, "testTag", 'dexter log: call ohos.hilog')
})
it('importSystemBuiltin', 0, async () => {
let lib = await import('@system.app')
lib.default.getInfo()
})
it('importAppNapi', 0, async () => {
let lib = await import('libentry.so')
expect(lib.default.add(2,3)).assertEqual(5)
})
})
}
\ No newline at end of file
arkcompiler/esmodule/esmodule_entry/entry/src/main/ets/test/List.test.ets
浏览文件 @
adc54128
...
@@ -13,11 +13,13 @@
...
@@ -13,11 +13,13 @@
* limitations under the License.
* limitations under the License.
*/
*/
import staticImport from './StaticImport'
import staticImport from './StaticImport'
import dynamicImport from './DynamicImport'
import workerImport from "./WorkerImport"
import workerImport from "./WorkerImport"
import pageImport from './PageImport'
import pageImport from './PageImport'
export default function testsuite() {
export default function testsuite() {
staticImport()
staticImport()
dynamicImport()
workerImport()
workerImport()
pageImport()
pageImport()
}
}
\ No newline at end of file
arkcompiler/esmodule/esmodule_ohostest/entry/oh-package.json5
浏览文件 @
adc54128
...
@@ -14,7 +14,9 @@
...
@@ -14,7 +14,9 @@
*/
*/
{
{
"license": "",
"license": "",
"devDependencies": {},
"devDependencies": {
"@types/libentry.so": "file:./src/ohosTest/cpp/types/libentry"
},
"author": "",
"author": "",
"name": "entry",
"name": "entry",
"description": "Please describe the basic information.",
"description": "Please describe the basic information.",
...
@@ -23,4 +25,4 @@
...
@@ -23,4 +25,4 @@
"dependencies": {
"dependencies": {
"har": "file:../har"
"har": "file:../har"
}
}
}
}
\ No newline at end of file
arkcompiler/esmodule/esmodule_ohostest/entry/src/ohosTest/cpp/CMakeLists.txt
0 → 100644
浏览文件 @
adc54128
# the minimum version of CMake.
cmake_minimum_required
(
VERSION 3.4.1
)
project
(
MyApplication8
)
set
(
NATIVERENDER_ROOT_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
)
include_directories
(
${
NATIVERENDER_ROOT_PATH
}
${
NATIVERENDER_ROOT_PATH
}
/include
)
add_library
(
entry SHARED hello.cpp
)
target_link_libraries
(
entry PUBLIC libace_napi.z.so
)
\ No newline at end of file
arkcompiler/esmodule/esmodule_ohostest/entry/src/ohosTest/cpp/hello.cpp
0 → 100644
浏览文件 @
adc54128
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "napi/native_api.h"
static
napi_value
Add
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
requireArgc
=
2
;
size_t
argc
=
2
;
napi_value
args
[
2
]
=
{
nullptr
};
napi_get_cb_info
(
env
,
info
,
&
argc
,
args
,
nullptr
,
nullptr
);
napi_valuetype
valuetype0
;
napi_typeof
(
env
,
args
[
0
],
&
valuetype0
);
napi_valuetype
valuetype1
;
napi_typeof
(
env
,
args
[
1
],
&
valuetype1
);
double
value0
;
napi_get_value_double
(
env
,
args
[
0
],
&
value0
);
double
value1
;
napi_get_value_double
(
env
,
args
[
1
],
&
value1
);
napi_value
sum
;
napi_create_double
(
env
,
value0
+
value1
,
&
sum
);
return
sum
;
}
EXTERN_C_START
static
napi_value
Init
(
napi_env
env
,
napi_value
exports
)
{
napi_property_descriptor
desc
[]
=
{
{
"add"
,
nullptr
,
Add
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
}
};
napi_define_properties
(
env
,
exports
,
sizeof
(
desc
)
/
sizeof
(
desc
[
0
]),
desc
);
return
exports
;
}
EXTERN_C_END
static
napi_module
demoModule
=
{
.
nm_version
=
1
,
.
nm_flags
=
0
,
.
nm_filename
=
nullptr
,
.
nm_register_func
=
Init
,
.
nm_modname
=
"entry"
,
.
nm_priv
=
((
void
*
)
0
),
.
reserved
=
{
0
},
};
extern
"C"
__attribute__
((
constructor
))
void
RegisterEntryModule
(
void
)
{
napi_module_register
(
&
demoModule
);
}
arkcompiler/esmodule/esmodule_ohostest/entry/src/ohosTest/cpp/types/libentry/index.d.ts
0 → 100644
浏览文件 @
adc54128
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
const
add
:
(
a
:
number
,
b
:
number
)
=>
number
;
\ No newline at end of file
arkcompiler/esmodule/esmodule_ohostest/entry/src/ohosTest/cpp/types/libentry/oh-package.json5
0 → 100644
浏览文件 @
adc54128
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"name": "libentry.so",
"types": "./index.d.ts",
"version": "",
"description": "Please describe the basic information."
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录