Skip to content

Commit

Permalink
Test that dotfiles resolve correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan committed Mar 6, 2019
1 parent 2038fa3 commit 792955e
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/.js
@@ -0,0 +1 @@
console.log('success')
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/.json
@@ -0,0 +1 @@
console.log('success')
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/.mjs
@@ -0,0 +1 @@
console.log('success')
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/.thing
@@ -0,0 +1 @@
console.log('success')
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/.thing-js.js
@@ -0,0 +1 @@
console.log('success')
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/.thing-json.json
@@ -0,0 +1 @@
console.log('success')
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/.thing-mjs.mjs
@@ -0,0 +1 @@
console.log('success')
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/mod-js/.thing-js.js
@@ -0,0 +1 @@
console.log('success')
3 changes: 3 additions & 0 deletions pax/fixtures/resolve/dotfiles/mod-js/package.json
@@ -0,0 +1,3 @@
{
"main": ".thing-js"
}
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/mod-json/.thing-json.json
@@ -0,0 +1 @@
console.log('success')
3 changes: 3 additions & 0 deletions pax/fixtures/resolve/dotfiles/mod-json/package.json
@@ -0,0 +1,3 @@
{
"main": ".thing-json"
}
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/mod-mjs/.thing-mjs.mjs
@@ -0,0 +1 @@
console.log('success')
3 changes: 3 additions & 0 deletions pax/fixtures/resolve/dotfiles/mod-mjs/package.json
@@ -0,0 +1,3 @@
{
"main": ".thing-mjs"
}
1 change: 1 addition & 0 deletions pax/fixtures/resolve/dotfiles/mod-noext/.thing
@@ -0,0 +1 @@
console.log('success')
3 changes: 3 additions & 0 deletions pax/fixtures/resolve/dotfiles/mod-noext/package.json
@@ -0,0 +1,3 @@
{
"main": ".thing"
}
34 changes: 34 additions & 0 deletions pax/src/test/mod.rs
Expand Up @@ -1141,6 +1141,40 @@ where F: FnMut(&str, &str, Option<&str>, &InputOptions) {
assert_resolves(ctx, "./unicode/𝌆.js",
Some("resolve/unicode/𝌆.js"), &cjs);

assert_resolves(ctx, "./dotfiles", None, &cjs);
assert_resolves(ctx, "./dotfiles/", None, &esm);

assert_resolves(ctx, "./dotfiles/.thing",
Some("resolve/dotfiles/.thing"), &cjs);
assert_resolves(ctx, "./dotfiles/.thing-js",
Some("resolve/dotfiles/.thing-js.js"), &cjs);
assert_resolves(ctx, "./dotfiles/.thing-js.js",
Some("resolve/dotfiles/.thing-js.js"), &cjs);
assert_resolves(ctx, "./dotfiles/.thing-json",
Some("resolve/dotfiles/.thing-json.json"), &cjs);
assert_resolves(ctx, "./dotfiles/.thing-json.json",
Some("resolve/dotfiles/.thing-json.json"), &cjs);
assert_resolves(ctx, "./dotfiles/.thing-mjs",
Some("resolve/dotfiles/.thing-mjs.mjs"), &esm);
assert_resolves(ctx, "./dotfiles/.thing-mjs.mjs",
Some("resolve/dotfiles/.thing-mjs.mjs"), &esm);

assert_resolves(ctx, "./dotfiles/.js",
Some("resolve/dotfiles/.js"), &cjs);
assert_resolves(ctx, "./dotfiles/.json",
Some("resolve/dotfiles/.json"), &cjs);
assert_resolves(ctx, "./dotfiles/.mjs",
Some("resolve/dotfiles/.mjs"), &esm);

assert_resolves(ctx, "./dotfiles/mod-noext",
Some("resolve/dotfiles/mod-noext/.thing"), &cjs);
assert_resolves(ctx, "./dotfiles/mod-js",
Some("resolve/dotfiles/mod-js/.thing-js.js"), &cjs);
assert_resolves(ctx, "./dotfiles/mod-json",
Some("resolve/dotfiles/mod-json/.thing-json.json"), &cjs);
assert_resolves(ctx, "./dotfiles/mod-mjs",
Some("resolve/dotfiles/mod-mjs/.thing-mjs.mjs"), &esm);

let ctx = "resolve-order/hypothetical.js";
assert_resolves(ctx, "./1-file",
Some("resolve-order/1-file"), &cjs);
Expand Down

0 comments on commit 792955e

Please sign in to comment.