Skip to content

Commit 325c21f

Browse files
committed
remove draft impl from tests
1 parent 48843f2 commit 325c21f

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

tests/wpt/mulibyte-encoder.test.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
11
import { createMultibyteEncoder } from '@exodus/bytes/multi-byte.js'
22
import { percentEncodeAfterEncoding } from '@exodus/bytes/whatwg.js'
33
import '@exodus/bytes/encoding.js'
4-
import { multibyteEncoder } from '../../fallback/multi-byte.js'
54
import { encodeLatin1 } from '../../fallback/latin1.js'
65
import { describe, test } from 'node:test'
76

87
const { unescape } = globalThis
98

10-
// C0 control percent-encode set: < 0x20 || > 0x7e
11-
// query percent-encode set: C0 control percent-encode set + ` "#<>`
12-
const querySet = (x) => x < 0x21 || x > 0x7e || x === 0x22 || x === 0x23 || x === 0x3c || x === 0x3e
13-
const esc1 = (x) => '%' + x.toString(16).padStart(2, '0').toUpperCase()
14-
const escArr = (u) => [...u].map((x) => (querySet(x) ? esc1(x) : String.fromCharCode(x))).join('')
15-
16-
function toUrl(encoding, input) {
17-
let encoded = ''
18-
let last = 0
19-
const escaping = multibyteEncoder(encoding, (cp, u, i) => {
20-
encoded += `${escArr(u.subarray(last, i))}%26%23${cp}%3B` // &#cp;
21-
last = i
22-
return 0 // no bytes emitted
23-
})
24-
25-
const u = escaping(input)
26-
encoded += escArr(u.subarray(last))
27-
return encoded
28-
}
29-
309
function testEncoder(encoding, fn) {
3110
describe(encoding, () => {
3211
const fatal = createMultibyteEncoder(encoding)
@@ -41,7 +20,6 @@ function testEncoder(encoding, fn) {
4120
}
4221

4322
// Full check
44-
t.assert.strictEqual(toUrl(encoding, input), escaped)
4523
t.assert.strictEqual(percentEncodeAfterEncoding(encoding, input, ' "#<>'), escaped)
4624
})
4725
})

0 commit comments

Comments
 (0)