Skip to content

Commit

Permalink
Travis: disable unicode tests on windows for now
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan committed Mar 6, 2019
1 parent 792955e commit 5024807
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Expand Up @@ -60,8 +60,12 @@ matrix:
#- env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1

# Windows
- env: TARGET=x86_64-pc-windows-gnu
- env: TARGET=i686-pc-windows-gnu
- env:
- TARGET=x86_64-pc-windows-gnu
- SKIP_TESTS="test_resolve_consistency test_resolve_unicode"
- env:
- TARGET=i686-pc-windows-gnu
- SKIP_TESTS="test_resolve_consistency test_resolve_unicode"

# Bare metal
# These targets don't support std and as such are likely not suitable for
Expand Down
12 changes: 8 additions & 4 deletions ci/script.sh 100644 β†’ 100755
Expand Up @@ -11,11 +11,15 @@ main() {
fi

if [ "$TARGET" = "x86_64-apple-darwin" ] && [ "$TRAVIS_OS_NAME" = osx ]; then
cargo test
cargo test --release
cargo test
cargo test --release
else
cross test --target $TARGET -- --skip test_resolve_consistency
cross test --target $TARGET --release -- --skip test_resolve_consistency
local skip=()
for s in ${SKIP_TESTS:-test_resolve_consistency}; do
if [ -n $s ]; then skip=("${skip[@]}" --skip $s); fi
done
cross test --target $TARGET -- "${skip[@]}"
cross test --target $TARGET --release -- "${skip[@]}"
fi
}

Expand Down
30 changes: 23 additions & 7 deletions pax/src/test/mod.rs
Expand Up @@ -286,6 +286,10 @@ fn assert_resolves(context: &str, from: &str, to: Option<&str>, input_options: &
fn test_resolve() {
test_resolve_with(assert_resolves);
}
#[test]
fn test_resolve_unicode() {
test_resolve_unicode_with(assert_resolves);
}
fn test_resolve_with<F>(mut assert_resolves: F)
where F: FnMut(&str, &str, Option<&str>, &InputOptions) {
let cjs = InputOptions {
Expand Down Expand Up @@ -1136,11 +1140,6 @@ where F: FnMut(&str, &str, Option<&str>, &InputOptions) {
Some("resolve/subdir/subdir2/node_modules/shadowed/index.js"), &cjs);

let ctx = "resolve/hypothetical.js";
assert_resolves(ctx, "./unicode/πŒ†",
Some("resolve/unicode/πŒ†.js"), &cjs);
assert_resolves(ctx, "./unicode/πŒ†.js",
Some("resolve/unicode/πŒ†.js"), &cjs);

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

Expand Down Expand Up @@ -1200,6 +1199,22 @@ where F: FnMut(&str, &str, Option<&str>, &InputOptions) {
Some("resolve-order/4-dir/index.json"), &cjs);
}

fn test_resolve_unicode_with<F>(mut assert_resolves: F)
where F: FnMut(&str, &str, Option<&str>, &InputOptions) {
let cjs = InputOptions {
for_browser: false,
es6_syntax: false,
es6_syntax_everywhere: false,
external: Default::default(),
};

let ctx = "resolve/hypothetical.js";
assert_resolves(ctx, "./unicode/πŒ†",
Some("resolve/unicode/πŒ†.js"), &cjs);
assert_resolves(ctx, "./unicode/πŒ†.js",
Some("resolve/unicode/πŒ†.js"), &cjs);
}

#[test]
fn test_resolve_consistency() {
// meta-test: ensure test_resolve matches node behavior
Expand All @@ -1211,7 +1226,7 @@ fn test_resolve_consistency() {
let mut esm = FnvHashMap::default();

{
let append = |ctx: &str, from: &str, to: Option<&str>, input_options: &InputOptions| {
let mut append = |ctx: &str, from: &str, to: Option<&str>, input_options: &InputOptions| {
let assertions = if input_options.es6_syntax {
&mut esm
} else {
Expand All @@ -1222,7 +1237,8 @@ fn test_resolve_consistency() {
.insert((from.to_owned(), to.map(ToOwned::to_owned)));
};

test_resolve_with(append);
test_resolve_with(&mut append);
test_resolve_unicode_with(&mut append);
}

fn make_source(base: &Path, cases: &Cases) -> Vec<u8> {
Expand Down

0 comments on commit 5024807

Please sign in to comment.