mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
f5e46c9bf2
This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit.
76 lines
2.9 KiB
JavaScript
76 lines
2.9 KiB
JavaScript
// deno-fmt-ignore-file
|
|
// deno-lint-ignore-file
|
|
|
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
|
// Taken from Node 18.12.1
|
|
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
|
|
|
|
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const path = require('path');
|
|
|
|
const failures = [];
|
|
|
|
const relativeTests = [
|
|
[ path.win32.relative,
|
|
// Arguments result
|
|
[['c:/blah\\blah', 'd:/games', 'd:\\games'],
|
|
['c:/aaaa/bbbb', 'c:/aaaa', '..'],
|
|
['c:/aaaa/bbbb', 'c:/cccc', '..\\..\\cccc'],
|
|
['c:/aaaa/bbbb', 'c:/aaaa/bbbb', ''],
|
|
['c:/aaaa/bbbb', 'c:/aaaa/cccc', '..\\cccc'],
|
|
['c:/aaaa/', 'c:/aaaa/cccc', 'cccc'],
|
|
['c:/', 'c:\\aaaa\\bbbb', 'aaaa\\bbbb'],
|
|
['c:/aaaa/bbbb', 'd:\\', 'd:\\'],
|
|
['c:/AaAa/bbbb', 'c:/aaaa/bbbb', ''],
|
|
['c:/aaaaa/', 'c:/aaaa/cccc', '..\\aaaa\\cccc'],
|
|
['C:\\foo\\bar\\baz\\quux', 'C:\\', '..\\..\\..\\..'],
|
|
['C:\\foo\\test', 'C:\\foo\\test\\bar\\package.json', 'bar\\package.json'],
|
|
['C:\\foo\\bar\\baz-quux', 'C:\\foo\\bar\\baz', '..\\baz'],
|
|
['C:\\foo\\bar\\baz', 'C:\\foo\\bar\\baz-quux', '..\\baz-quux'],
|
|
['\\\\foo\\bar', '\\\\foo\\bar\\baz', 'baz'],
|
|
['\\\\foo\\bar\\baz', '\\\\foo\\bar', '..'],
|
|
['\\\\foo\\bar\\baz-quux', '\\\\foo\\bar\\baz', '..\\baz'],
|
|
['\\\\foo\\bar\\baz', '\\\\foo\\bar\\baz-quux', '..\\baz-quux'],
|
|
['C:\\baz-quux', 'C:\\baz', '..\\baz'],
|
|
['C:\\baz', 'C:\\baz-quux', '..\\baz-quux'],
|
|
['\\\\foo\\baz-quux', '\\\\foo\\baz', '..\\baz'],
|
|
['\\\\foo\\baz', '\\\\foo\\baz-quux', '..\\baz-quux'],
|
|
['C:\\baz', '\\\\foo\\bar\\baz', '\\\\foo\\bar\\baz'],
|
|
['\\\\foo\\bar\\baz', 'C:\\baz', 'C:\\baz'],
|
|
],
|
|
],
|
|
[ path.posix.relative,
|
|
// Arguments result
|
|
[['/var/lib', '/var', '..'],
|
|
['/var/lib', '/bin', '../../bin'],
|
|
['/var/lib', '/var/lib', ''],
|
|
['/var/lib', '/var/apache', '../apache'],
|
|
['/var/', '/var/lib', 'lib'],
|
|
['/', '/var/lib', 'var/lib'],
|
|
['/foo/test', '/foo/test/bar/package.json', 'bar/package.json'],
|
|
['/Users/a/web/b/test/mails', '/Users/a/web/b', '../..'],
|
|
['/foo/bar/baz-quux', '/foo/bar/baz', '../baz'],
|
|
['/foo/bar/baz', '/foo/bar/baz-quux', '../baz-quux'],
|
|
['/baz-quux', '/baz', '../baz'],
|
|
['/baz', '/baz-quux', '../baz-quux'],
|
|
['/page1/page2/foo', '/', '../../..'],
|
|
],
|
|
],
|
|
];
|
|
relativeTests.forEach((test) => {
|
|
const relative = test[0];
|
|
test[1].forEach((test) => {
|
|
const actual = relative(test[0], test[1]);
|
|
const expected = test[2];
|
|
if (actual !== expected) {
|
|
const os = relative === path.win32.relative ? 'win32' : 'posix';
|
|
const message = `path.${os}.relative(${
|
|
test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${
|
|
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
|
|
failures.push(`\n${message}`);
|
|
}
|
|
});
|
|
});
|
|
assert.strictEqual(failures.length, 0, failures.join(''));
|