diff options
author | Bradley Farias <bradley.meck@gmail.com> | 2017-06-05 19:44:56 -0500 |
---|---|---|
committer | Bradley Farias <bradley.meck@gmail.com> | 2017-09-07 15:18:32 -0500 |
commit | c8a389e19f172edbada83f59944cad7cc802d9d5 (patch) | |
tree | 15a8653683a97ff0d6b2e7f08ef8081405700ea3 /test/cctest/test_url.cc | |
parent | 46133b5beba2c780fb3b9a9d6be610d09f752182 (diff) | |
download | android-node-v8-c8a389e19f172edbada83f59944cad7cc802d9d5.tar.gz android-node-v8-c8a389e19f172edbada83f59944cad7cc802d9d5.tar.bz2 android-node-v8-c8a389e19f172edbada83f59944cad7cc802d9d5.zip |
module: Allow runMain to be ESM
This follows the EPS an allows the node CLI to have ESM as an entry point.
`node ./example.mjs`. A newer V8 is needed for `import()` so that is not
included. `import.meta` is still in specification stage so that also is not
included.
PR-URL: https://github.com/nodejs/node/pull/14369
Author: Bradley Farias <bradley.meck@gmail.com>
Author: Guy Bedford <guybedford@gmail.com>
Author: Jan Krems <jan.krems@groupon.com>
Author: Timothy Gu <timothygu99@gmail.com>
Author: Michaël Zasso <targos@protonmail.com>
Author: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'test/cctest/test_url.cc')
-rw-r--r-- | test/cctest/test_url.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/cctest/test_url.cc b/test/cctest/test_url.cc index 2cede1a8a3..0b80d44caa 100644 --- a/test/cctest/test_url.cc +++ b/test/cctest/test_url.cc @@ -79,3 +79,28 @@ TEST_F(URLTest, Base3) { EXPECT_EQ(simple.host(), "example.org"); EXPECT_EQ(simple.path(), "/baz"); } + +TEST_F(URLTest, ToFilePath) { +#define T(url, path) EXPECT_EQ(path, URL(url).ToFilePath()) + T("http://example.org/foo/bar", ""); + +#ifdef _WIN32 + T("file:///C:/Program%20Files/", "C:\\Program Files\\"); + T("file:///C:/a/b/c?query#fragment", "C:\\a\\b\\c"); + T("file://host/path/a/b/c?query#fragment", "\\\\host\\path\\a\\b\\c"); + T("file://xn--weird-prdj8vva.com/host/a", "\\\\wͪ͊eiͬ͋rd.com\\host\\a"); + T("file:///C:/a%2Fb", ""); + T("file:///", ""); + T("file:///home", ""); +#else + T("file:///", "/"); + T("file:///home/user?query#fragment", "/home/user"); + T("file:///home/user/?query#fragment", "/home/user/"); + T("file:///home/user/%20space", "/home/user/ space"); + T("file:///home/us%5Cer", "/home/us\\er"); + T("file:///home/us%2Fer", ""); + T("file://host/path", ""); +#endif + +#undef T +} |