提交 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();
......@@ -46,7 +46,10 @@ export function runTests() : UTSJSONObject {
const ArrayBufferRes = testArrayBuffer();
// #endif
const NativeCodeRes = testNativeCode();
const PromiseRes = testPromise();
const PromiseRes = testPromise();
// #ifdef APP-ANDROID || WEB
const TextEncoderRes = testEncoder();
// #endif
return {
Array: ArrayRes,
Date: DateRes,
......@@ -67,7 +70,8 @@ export function runTests() : UTSJSONObject {
console: consoleRes,
UTSJSONObject: UTSJSONObjectRes,
// #ifdef APP-ANDROID || WEB
ArrayBuffer: ArrayBufferRes,
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.
先完成此消息的编辑!
想要评论请 注册