提交 86ff7baf 编写于 作者: M mahaifeng

[textencoder]添加测试用例

上级 4056fb2f
import { describe, test, expect, Result } from './tests.uts'
export function testEncoder() : Result {
return describe("TextEncoder", () => {
test('encoder', () => {
// #TEST TextEncoder.encode
const encoder = new TextEncoder()
const int8 = encoder.encode("€");
console.log(int8); // Uint8Array(3) [226, 130, 172]
// #END
expect(int8.toString()).toEqual("226,130,172");
})
})
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ import { testType } from './Type.uts'
export { Result } from './tests.uts'
import { testArrayBuffer } from './ArrayBuffer.uts'
import { testNativeCode } from './NativeCode.uts'
import { testEncoder} from "./TextEncoder.uts"
// Promise、Proxy、Reflect、Weakmap、WeakSet 不支持
export function runTests() : UTSJSONObject {
......@@ -46,6 +46,9 @@ export function runTests() : UTSJSONObject {
const ArrayBufferRes = testArrayBuffer();
// #endif
const NativeCodeRes = testNativeCode();
// #ifdef APP-ANDROID || WEB
const TextEncoderRes = testEncoder();
// #endif
return {
Array: ArrayRes,
Date: DateRes,
......@@ -67,6 +70,7 @@ export function runTests() : UTSJSONObject {
UTSJSONObject: UTSJSONObjectRes,
// #ifdef APP-ANDROID || WEB
ArrayBuffer: ArrayBufferRes,
TextEncoder: TextEncoderRes,
// #endif
NativeCode: NativeCodeRes
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册