提交 99beeed6 编写于 作者: M mahaifeng

[textencoder]添加测试用例

上级 f59ac888
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
......@@ -20,7 +20,7 @@ export { Result } from './tests.uts'
import { testArrayBuffer } from './ArrayBuffer.uts'
import { testNativeCode } from './NativeCode.uts'
import { testPromise} from "./Promise.uts"
import { testEncoder} from "./TextEncoder.uts"
// Proxy、Reflect、Weakmap、WeakSet 不支持
export function runTests() : UTSJSONObject {
const ArrayRes = testArray();
......@@ -47,6 +47,9 @@ export function runTests() : UTSJSONObject {
// #endif
const NativeCodeRes = testNativeCode();
const PromiseRes = testPromise();
// #ifdef APP-ANDROID || WEB
const TextEncoderRes = testEncoder();
// #endif
return {
Array: ArrayRes,
Date: DateRes,
......@@ -68,6 +71,7 @@ export function runTests() : UTSJSONObject {
UTSJSONObject: UTSJSONObjectRes,
// #ifdef APP-ANDROID || WEB
ArrayBuffer: ArrayBufferRes,
TextEncoder: TextEncoderRes,
// #endif
NativeCode: NativeCodeRes,
Primise: PromiseRes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册