Skip to content

Commit b027336

Browse files
knightburtonyichoi
authored andcommitted
Fix the stringToCesu8 tests offset arguments (#12)
IoT.js-Debug-DCO-1.0-Signed-off-by: Imre Kiss [email protected]
1 parent b6bb604 commit b027336

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/test/JerryUtils.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ suite('Jerry Utils', () => {
261261

262262
test('returns empty array for empty string, and vice versa', () => {
263263
assert.strictEqual(cesu8ToString(new Uint8Array(0)), '');
264-
assert.deepStrictEqual(stringToCesu8('', 5, defConfig), new Uint8Array(0));
264+
assert.deepStrictEqual(stringToCesu8('', 0, defConfig), new Uint8Array(0));
265265
});
266266

267267
test('returns ASCII from ASCII', () => {
@@ -271,7 +271,7 @@ suite('Jerry Utils', () => {
271271
array[i] = sentence.charCodeAt(i);
272272
}
273273
assert.deepStrictEqual(cesu8ToString(array), sentence);
274-
assert.deepStrictEqual(stringToCesu8(sentence, 5, defConfig), array);
274+
assert.deepStrictEqual(stringToCesu8(sentence, 0, defConfig), array);
275275
});
276276

277277
test('acts like UTF-8 for two-byte encodings', () => {
@@ -281,8 +281,8 @@ suite('Jerry Utils', () => {
281281
const highTwoByte = Uint8Array.from([0xc0 + 0x1f, 0x80 + 0x3f]);
282282
assert.deepStrictEqual(cesu8ToString(lowTwoByte), String.fromCharCode(0x80));
283283
assert.deepStrictEqual(cesu8ToString(highTwoByte), String.fromCharCode(0x7ff));
284-
assert.deepStrictEqual(stringToCesu8(String.fromCharCode(0x80), 5, defConfig), lowTwoByte);
285-
assert.deepStrictEqual(stringToCesu8(String.fromCharCode(0x7ff), 5, defConfig), highTwoByte);
284+
assert.deepStrictEqual(stringToCesu8(String.fromCharCode(0x80), 0, defConfig), lowTwoByte);
285+
assert.deepStrictEqual(stringToCesu8(String.fromCharCode(0x7ff), 0, defConfig), highTwoByte);
286286
});
287287

288288
test('acts like UTF-8 for three-byte encodings', () => {
@@ -292,8 +292,8 @@ suite('Jerry Utils', () => {
292292
const highThreeByte = Uint8Array.from([0xe0 + 0x0f, 0x80 + 0x3f, 0x80 + 0x3f]);
293293
assert.deepStrictEqual(cesu8ToString(lowThreeByte), String.fromCharCode(0x0800));
294294
assert.deepStrictEqual(cesu8ToString(highThreeByte), String.fromCharCode(0xffff));
295-
assert.deepStrictEqual(stringToCesu8(String.fromCharCode(0x0800), 5, defConfig), lowThreeByte);
296-
assert.deepStrictEqual(stringToCesu8(String.fromCharCode(0xffff), 5, defConfig), highThreeByte);
295+
assert.deepStrictEqual(stringToCesu8(String.fromCharCode(0x0800), 0, defConfig), lowThreeByte);
296+
assert.deepStrictEqual(stringToCesu8(String.fromCharCode(0xffff), 0, defConfig), highThreeByte);
297297
});
298298

299299
test('decodes UTF-16 surrogate pairs', () => {
@@ -306,7 +306,7 @@ suite('Jerry Utils', () => {
306306
0xe0 + 0x0d, 0x80 + 0x38, 0x80 + 0x02,
307307
]);
308308
assert.deepStrictEqual(cesu8ToString(surrogatePairBytes), '😂');
309-
assert.deepStrictEqual(stringToCesu8('😂', 5, defConfig), surrogatePairBytes);
309+
assert.deepStrictEqual(stringToCesu8('😂', 0, defConfig), surrogatePairBytes);
310310
});
311311
});
312312

0 commit comments

Comments
 (0)