Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
16a6ae5b
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看板
提交
16a6ae5b
编写于
2月 15, 2022
作者:
X
xdmal
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Signed-off-by: xdmal <maxiaodong16@huawei.com>
On branch master Your branch is up to date with 'origin/master'.
上级
8874f261
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
96 addition
and
96 deletion
+96
-96
compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js
...nvertxml_lib_standard/src/main/js/test/convertxml.test.js
+40
-40
compileruntime/uri_lib_standard/src/main/js/test/uri.test.js
compileruntime/uri_lib_standard/src/main/js/test/uri.test.js
+56
-56
未找到文件。
compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js
浏览文件 @
16a6ae5b
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
convertXml
from
'
@ohos.convertxml
'
import
ConvertXML
from
'
@ohos.convertxml
'
describe
(
'
XmlTest
'
,
function
()
{
/**
...
...
@@ -30,7 +30,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
spaces
:
0
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -67,7 +67,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
trim
:
true
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -104,7 +104,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
ignoreDeclaration
:
true
});
var
str1
=
'
{"_elements":[{"_type":"element",
'
+
'
"_name":"note",
'
+
...
...
@@ -140,7 +140,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
ignoreInstruction
:
true
});
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -178,7 +178,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
ignoreAttributes
:
true
});
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -214,7 +214,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
ignoreComment
:
true
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -252,7 +252,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
ignoreComment
:
true
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -290,7 +290,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
ignoreCDATA
:
true
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -325,7 +325,7 @@ describe('XmlTest', function () {
'
<note importance="high" logged="true">
'
+
'
<title>Happy</title>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
spaces
:
4
})
var
str
=
'
{
\n
'
+
'
"_declaration": {
\n
'
+
...
...
@@ -375,7 +375,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
ignoreDoctype
:
true
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -412,7 +412,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
ignoreText
:
true
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -443,7 +443,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
declarationKey
:
"
123
"
})
var
str1
=
'
{"123":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -481,7 +481,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
instructionKey
:
"
123
"
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -522,7 +522,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
attributesKey
:
"
123
"
})
var
str1
=
'
{"_declaration":{"123":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -562,7 +562,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
textKey
:
"
123
"
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -600,7 +600,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
cdataKey
:
"
123
"
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -640,7 +640,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
commentKey
:
"
123
"
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -680,7 +680,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
parentKey
:
"
123
"
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -721,7 +721,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
typeKey
:
"
123
"
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -758,7 +758,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
nameKey
:
"
123
"
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}},
'
+
...
...
@@ -795,7 +795,7 @@ describe('XmlTest', function () {
'
<todo>Work</todo>
'
+
'
<todo>Play</todo>
'
+
'
</note>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
,
elementsKey
:
"
123
"
})
var
str1
=
'
{"123":[{"123":[{"123":[{"_type":"text",
'
+
'
"_text":"Happy"}],
'
+
...
...
@@ -826,7 +826,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert022
'
,
0
,
function
()
{
var
xml
=
'
<?xml?>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_declaration":{}}
'
expect
(
result1
).
assertEqual
(
str1
);
...
...
@@ -840,7 +840,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert023
'
,
0
,
function
()
{
var
xml
=
'
<?xml version="1.0" encoding="utf-8"?>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_declaration":{"_attributes":{"version":"1.0",
'
+
'
"encoding":"utf-8"}}}
'
...
...
@@ -855,7 +855,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert024
'
,
0
,
function
()
{
var
xml
=
'
<?xml?>
\n
<a/>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_declaration":{},"_elements":[{"_type":"element","_name":"a"}]}
'
expect
(
result1
).
assertEqual
(
str1
);
...
...
@@ -869,7 +869,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert025
'
,
0
,
function
()
{
var
xml
=
'
<?go there?>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"instruction",
'
+
'
"_name":"go",
'
+
...
...
@@ -885,7 +885,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert026
'
,
0
,
function
()
{
var
xml
=
'
<?go there?><?come here?>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"instruction",
'
+
'
"_name":"go",
'
+
...
...
@@ -904,7 +904,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert027
'
,
0
,
function
()
{
var
xml
=
'
<!--
\t
Hello World!
\t
-->
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"comment","_comment":"
'
+
'
\t
'
+
...
...
@@ -923,7 +923,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert028
'
,
0
,
function
()
{
var
xml
=
'
<!--
\t
Hello
\t
-->
\n
<!--
\t
World
\t
-->
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"comment","_comment":"
'
+
'
\t
'
+
...
...
@@ -945,7 +945,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert029
'
,
0
,
function
()
{
var
xml
=
'
<![CDATA[
\t
<foo></bar>
\t
]]>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"cdata","_cdata":"
'
+
'
\t
'
+
...
...
@@ -963,7 +963,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert030
'
,
0
,
function
()
{
var
xml
=
'
<![CDATA[
\t
data]]><![CDATA[< > " and &
\t
]]>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"cdata","_cdata":"
'
+
'
\t
'
+
...
...
@@ -985,7 +985,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert031
'
,
0
,
function
()
{
var
xml
=
'
<a/>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element",
'
+
'
"_name":"a"}]}
'
...
...
@@ -1000,7 +1000,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert032
'
,
0
,
function
()
{
var
xml
=
'
<a/>
\n
<a/>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element",
'
+
'
"_name":"a"},
'
+
...
...
@@ -1017,7 +1017,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert033
'
,
0
,
function
()
{
var
xml
=
'
<a/>
\n
<b/>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element",
'
+
'
"_name":"a"},
'
+
...
...
@@ -1034,7 +1034,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert034
'
,
0
,
function
()
{
var
xml
=
'
<a x="hello"/>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element",
'
+
'
"_name":"a",
'
+
...
...
@@ -1050,7 +1050,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert035
'
,
0
,
function
()
{
var
xml
=
'
<a x="1.234" y="It
\'
s"/>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element",
'
+
'
"_name":"a",
'
+
...
...
@@ -1067,7 +1067,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert036
'
,
0
,
function
()
{
var
xml
=
'
<a>
\t
Hi
\t
</a>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element","_name":"a","_elements":[{"_type":"text","_text":"
'
+
'
\t
'
+
...
...
@@ -1085,7 +1085,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert037
'
,
0
,
function
()
{
var
xml
=
'
<a> Hi There
\t
</a>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element","_name":"a","_elements":[{"_type":"text","_text":"
'
+
'
Hi
'
+
...
...
@@ -1103,7 +1103,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert038
'
,
0
,
function
()
{
var
xml
=
'
<a>
\n\
v<b/>
\n
</a>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element",
'
+
'
"_name":"a",
'
+
...
...
@@ -1120,7 +1120,7 @@ describe('XmlTest', function () {
*/
it
(
'
testConvert039
'
,
0
,
function
()
{
var
xml
=
'
<a>
\n\
v<b>
\n\
v
\
v<c/>
\n\
v</b>
\n
</a>
'
;
var
convertml
=
new
convertXml
.
ConvertXML
();
var
convertml
=
new
ConvertXML
();
var
result1
=
convertml
.
convert
(
xml
,
{
compact
:
false
})
var
str1
=
'
{"_elements":[{"_type":"element",
'
+
'
"_name":"a",
'
+
...
...
compileruntime/uri_lib_standard/src/main/js/test/uri.test.js
浏览文件 @
16a6ae5b
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录