mirror of
https://github.com/denoland/deno.git
synced 2024-12-30 02:59:11 -05:00
fb24fd37c9
This PR enables node compat test cases found passing by using the tool added in #27122 The percentage of passing test case increases from 16.16% to 30.43% by this change.
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
// deno-fmt-ignore-file
|
|
// deno-lint-ignore-file
|
|
|
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
|
// Taken from Node 20.11.1
|
|
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
|
|
|
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const util = require('internal/util');
|
|
|
|
const tests = [
|
|
[undefined, 'utf8'],
|
|
[null, 'utf8'],
|
|
['', 'utf8'],
|
|
['utf8', 'utf8'],
|
|
['utf-8', 'utf8'],
|
|
['UTF-8', 'utf8'],
|
|
['UTF8', 'utf8'],
|
|
['Utf8', 'utf8'],
|
|
['uTf-8', 'utf8'],
|
|
['utF-8', 'utf8'],
|
|
['ucs2', 'utf16le'],
|
|
['UCS2', 'utf16le'],
|
|
['UcS2', 'utf16le'],
|
|
['ucs-2', 'utf16le'],
|
|
['UCS-2', 'utf16le'],
|
|
['UcS-2', 'utf16le'],
|
|
['utf16le', 'utf16le'],
|
|
['utf-16le', 'utf16le'],
|
|
['UTF-16LE', 'utf16le'],
|
|
['UTF16LE', 'utf16le'],
|
|
['binary', 'latin1'],
|
|
['BINARY', 'latin1'],
|
|
['latin1', 'latin1'],
|
|
['LaTiN1', 'latin1'],
|
|
['base64', 'base64'],
|
|
['BASE64', 'base64'],
|
|
['Base64', 'base64'],
|
|
['base64url', 'base64url'],
|
|
['BASE64url', 'base64url'],
|
|
['Base64url', 'base64url'],
|
|
['hex', 'hex'],
|
|
['HEX', 'hex'],
|
|
['ASCII', 'ascii'],
|
|
['AsCii', 'ascii'],
|
|
['foo', undefined],
|
|
[1, undefined],
|
|
[false, undefined],
|
|
[NaN, undefined],
|
|
[0, undefined],
|
|
[[], undefined],
|
|
[{}, undefined],
|
|
];
|
|
|
|
tests.forEach((e, i) => {
|
|
const res = util.normalizeEncoding(e[0]);
|
|
assert.strictEqual(res, e[1], `#${i} failed: expected ${e[1]}, got ${res}`);
|
|
});
|