TextEncoder.uts 427 字节
Newer Older
M
mahaifeng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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");
    })
  })
}