Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
405451a0
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看板
未验证
提交
405451a0
编写于
6月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3496 Add decoding use cases for GBK, GB8030 and GB2312 character sets
Merge pull request !3496 from 小马奔腾/master
上级
75e10aee
61824db0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
137 addition
and
0 deletion
+137
-0
compileruntime/util_lib_standard/src/main/js/test/util.test.js
...leruntime/util_lib_standard/src/main/js/test/util.test.js
+137
-0
未找到文件。
compileruntime/util_lib_standard/src/main/js/test/util.test.js
浏览文件 @
405451a0
...
...
@@ -540,6 +540,42 @@ describe('TextEncoderTest', function () {
expect
(
fatalStr
).
assertEqual
(
false
)
})
/**
* @tc.name: testFatal006
* @tc.desc: Returns `true` if error mode is "fatal", and `false` otherwise.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testFatal006
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gbk
'
)
var
fatalStr
=
that
.
fatal
expect
(
fatalStr
).
assertEqual
(
false
)
})
/**
* @tc.name: testFatal007
* @tc.desc: Returns `true` if error mode is "fatal", and `false` otherwise.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testFatal007
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gb18030
'
)
var
fatalStr
=
that
.
fatal
expect
(
fatalStr
).
assertEqual
(
false
)
})
/**
* @tc.name: testFatal008
* @tc.desc: Returns `true` if error mode is "fatal", and `false` otherwise.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testFatal008
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gb2312
'
)
var
fatalStr
=
that
.
fatal
expect
(
fatalStr
).
assertEqual
(
false
)
})
/**
* @tc.name: testIgnoreBOM001
* @tc.desc: Returns `true` if ignore BOM flag is set, and `false` otherwise.
...
...
@@ -600,6 +636,41 @@ describe('TextEncoderTest', function () {
expect
(
ignoreBOMStr
).
assertEqual
(
false
)
})
/**
* @tc.name: testIgnoreBOM006
* @tc.desc: Returns `true` if ignore BOM flag is set, and `false` otherwise.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testIgnoreBOM006
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gbk
'
)
var
ignoreBOMStr
=
that
.
ignoreBOM
expect
(
ignoreBOMStr
).
assertEqual
(
false
)
})
/**
* @tc.name: testIgnoreBOM006
* @tc.desc: Returns `true` if ignore BOM flag is set, and `false` otherwise.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testIgnoreBOM006
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gb18030
'
)
var
ignoreBOMStr
=
that
.
ignoreBOM
expect
(
ignoreBOMStr
).
assertEqual
(
false
)
})
/**
* @tc.name: testIgnoreBOM008
* @tc.desc: Returns `true` if ignore BOM flag is set, and `false` otherwise.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testIgnoreBOM008
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gb2312
'
)
var
ignoreBOMStr
=
that
.
ignoreBOM
expect
(
ignoreBOMStr
).
assertEqual
(
false
)
})
/**
* @tc.name: testDecode001
...
...
@@ -704,6 +775,72 @@ describe('TextEncoderTest', function () {
expect
(
retStr
).
assertEqual
(
re
)
})
/**
* @tc.name: testDecode006
* @tc.desc: Returns the result of running encoding's decoder.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testDecode006
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gbk
'
)
var
arr
=
new
Uint8Array
(
8
)
arr
[
0
]
=
0xC4
;
arr
[
1
]
=
0xE3
;
arr
[
2
]
=
0xBA
;
arr
[
3
]
=
0xC3
;
arr
[
4
]
=
0xCA
;
arr
[
5
]
=
0xC0
;
arr
[
6
]
=
0xBD
;
arr
[
7
]
=
0xE7
;
var
retStr
=
that
.
decode
(
arr
)
var
rel
=
'
你好世界
'
expect
(
retStr
).
assertEqual
(
rel
)
})
/**
* @tc.name: testDecode007
* @tc.desc: Returns the result of running encoding's decoder.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testDecode007
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gb18030
'
)
var
arr
=
new
Uint8Array
(
8
)
arr
[
0
]
=
0xC4
;
arr
[
1
]
=
0xE3
;
arr
[
2
]
=
0xBA
;
arr
[
3
]
=
0xC3
;
arr
[
4
]
=
0xCA
;
arr
[
5
]
=
0xC0
;
arr
[
6
]
=
0xBD
;
arr
[
7
]
=
0xE7
;
var
retStr
=
that
.
decode
(
arr
)
var
rel
=
'
你好世界
'
expect
(
retStr
).
assertEqual
(
rel
)
})
/**
* @tc.name: testDecode008
* @tc.desc: Returns the result of running encoding's decoder.
* @tc.require: AR000GFB4U
* @tc.author: wangben
*/
it
(
'
testDecode008
'
,
0
,
function
()
{
var
that
=
new
util
.
TextDecoder
(
'
gb2312
'
)
var
arr
=
new
Uint8Array
(
8
)
arr
[
0
]
=
0xC4
;
arr
[
1
]
=
0xE3
;
arr
[
2
]
=
0xBA
;
arr
[
3
]
=
0xC3
;
arr
[
4
]
=
0xCA
;
arr
[
5
]
=
0xC0
;
arr
[
6
]
=
0xBD
;
arr
[
7
]
=
0xE7
;
var
retStr
=
that
.
decode
(
arr
)
var
rel
=
'
你好世界
'
expect
(
retStr
).
assertEqual
(
rel
)
})
/**
* @tc.name: testGetEncoding001
* @tc.desc: Encoding format.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录