Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
81ee00d6
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看板
未验证
提交
81ee00d6
编写于
8月 23, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 23, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9810 Added cases of Textdecoder parsing 0 in uint8array
Merge pull request !9810 from jiangkai/master
上级
351540f1
25989e98
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
14 deletion
+47
-14
commonlibrary/ets_utils/util2_lib_standard/src/main/js/test/util.test.js
...ts_utils/util2_lib_standard/src/main/js/test/util.test.js
+47
-14
未找到文件。
commonlibrary/ets_utils/util2_lib_standard/src/main/js/test/util.test.js
浏览文件 @
81ee00d6
...
...
@@ -3981,7 +3981,7 @@ describe('Base64HelperTest', function () {
var
array
=
new
Uint32Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
var
result
=
that
.
encodeSync
(
array
);
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be Uint8Array
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be Uint8Array
"
)
}
})
...
...
@@ -4051,7 +4051,7 @@ describe('Base64HelperTest', function () {
var
array
=
new
Uint32Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
var
result
=
that
.
encodeToStringSync
(
array
);
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be Uint8Array
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be Uint8Array
"
)
}
})
...
...
@@ -4142,7 +4142,7 @@ describe('Base64HelperTest', function () {
var
array
=
new
Uint32Array
([
99
,
122
,
69
,
122
]);
var
result
=
that
.
decodeSync
(
array
);
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be Uint8Array or string
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be Uint8Array or string
"
)
}
})
...
...
@@ -4302,7 +4302,7 @@ describe('Base64HelperTest', function () {
var
array
=
new
Uint32Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
that
.
encode
(
array
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be Uint8Array
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be Uint8Array
"
)
}
})
...
...
@@ -4378,7 +4378,7 @@ describe('Base64HelperTest', function () {
var
array
=
new
Uint32Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
that
.
encodeToString
(
array
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be Uint8Array
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be Uint8Array
"
)
}
})
...
...
@@ -4555,7 +4555,7 @@ describe('Base64HelperTest', function () {
var
array
=
new
Uint16Array
([
99
,
122
,
69
,
122
]);
that
.
decode
(
array
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be Uint8Array or string
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be Uint8Array or string
"
)
}
})
...
...
@@ -4734,7 +4734,7 @@ describe('DecodeEncodeTest', function () {
* @tc.desc: The source encoding's name, lowercased.
*/
it
(
'
testTextDecoderCreate007
'
,
0
,
function
()
{
var
that
=
util
.
TextDecoder
.
create
({
ignoreBOM
:
false
})
var
that
=
util
.
TextDecoder
.
create
(
undefined
,
{
ignoreBOM
:
false
})
var
encodingStr
=
that
.
encoding
expect
(
encodingStr
).
assertEqual
(
'
utf-8
'
)
})
...
...
@@ -4809,7 +4809,7 @@ describe('DecodeEncodeTest', function () {
var
encodingStr
=
that
.
encoding
expect
(
encodingStr
).
assertEqual
(
'
utf-16be
'
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be string.
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be string.
"
)
}
})
...
...
@@ -4823,7 +4823,7 @@ describe('DecodeEncodeTest', function () {
var
encodingStr
=
that
.
encoding
expect
(
encodingStr
).
assertEqual
(
'
utf-16be
'
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be object.
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be object.
"
)
}
})
...
...
@@ -4837,10 +4837,43 @@ describe('DecodeEncodeTest', function () {
var
encodingStr
=
that
.
encoding
expect
(
encodingStr
).
assertEqual
(
'
utf-16be
'
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be object.
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be object.
"
)
}
})
/**
* @tc.name: decodeWithStream001
* @tc.desc: Returns the result of running encoding's decoder.
*/
it
(
'
decodeWithStream001
'
,
0
,
function
()
{
const
that
=
util
.
TextDecoder
.
create
(
'
utf-8
'
);
const
uint8arr
=
new
Uint8Array
([
0
,
65
,
49
,
53
,
79
,
75
,
70
,
69
]);
var
retStr
=
that
.
decodeWithStream
(
uint8arr
);
expect
(
retStr
).
assertEqual
(
'
A15OKFE
'
)
})
/**
* @tc.name: decodeWithStream002
* @tc.desc: Returns the result of running encoding's decoder.
*/
it
(
'
decodeWithStream002
'
,
0
,
function
()
{
const
that
=
util
.
TextDecoder
.
create
(
'
utf-8
'
);
const
uint8arr
=
new
Uint8Array
([
67
,
65
,
49
,
53
,
0
,
109
,
112
]);
let
retStr
=
that
.
decodeWithStream
(
uint8arr
);
expect
(
retStr
).
assertEqual
(
'
CA15 mp
'
)
})
/**
* @tc.name: decodeWithStream003
* @tc.desc: Returns the result of running encoding's decoder.
*/
it
(
'
decodeWithStream003
'
,
0
,
function
()
{
const
that
=
util
.
TextDecoder
.
create
(
'
utf-8
'
);
const
uint8arr
=
new
Uint8Array
([
84
,
67
,
65
,
53
,
49
,
79
,
0
]);
var
retStr
=
that
.
decodeWithStream
(
uint8arr
);
expect
(
retStr
).
assertEqual
(
'
TCA51O
'
)
})
/**
* @tc.name: testEncodeInto001
* @tc.desc: Returns the result of encoder.
...
...
@@ -4982,7 +5015,7 @@ describe('DecodeEncodeTest', function () {
result
=
that
.
encodeInto
(
123
)
expect
(
result
[
0
]).
assertEqual
(
0x61
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be string.
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be string.
"
)
}
})
...
...
@@ -4998,7 +5031,7 @@ describe('DecodeEncodeTest', function () {
result
=
that
.
encodeInto
({
ignoreBOM
:
true
})
expect
(
result
[
0
]).
assertEqual
(
0x61
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be string.
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be string.
"
)
}
})
...
...
@@ -5128,7 +5161,7 @@ describe('DecodeEncodeTest', function () {
expect
(
result
.
read
).
assertEqual
(
7
)
expect
(
result
.
written
).
assertEqual
(
13
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be string.
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be string.
"
)
}
})
...
...
@@ -5146,7 +5179,7 @@ describe('DecodeEncodeTest', function () {
expect
(
result
.
read
).
assertEqual
(
7
)
expect
(
result
.
written
).
assertEqual
(
13
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
is
nessError: The type of Parameter must be Uint8Array.
"
)
expect
(
e
.
toString
()).
assertEqual
(
"
Bu
si
nessError: The type of Parameter must be Uint8Array.
"
)
}
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录