Skip to content
Myr

[Tests] `nvm_offline_version`: make it executable; pin `nvm_ls_cached` cache visibility

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The test was born without its executable bit, and urchin silently skips non-executable files, so it has never run. Also pin what `nvm_ls_cached` can currently see: only bin-cached node artifacts - bin-cached io.js, and src-cached anything, are invisible to it, and thus to `--offline` version resolution.

authored by Jordan Harband · committed by Jordan Harband · parent 3a8b51c · Browse files · 1 file+35 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+35 added−0 removed

  • tests:+35 added−0 removed

1 file+35 added−0 removed

modified:test/fast/Unit tests/nvm_offline_version+35 added
8 unmodified lines
9TEST_DIR="$(pwd)/nvm_offline_version_tmp"1011cleanup() {12 rm -rf "${TEST_DIR}"13 CACHE_DIR="$(nvm_cache_dir)"14 SUFFIX="$(nvm_get_os)-$(nvm_get_arch)"15 rm -rf "${CACHE_DIR}/bin/node-v0.99.98-${SUFFIX}" "${CACHE_DIR}/bin/iojs-v0.99.97-${SUFFIX}" \16 "${CACHE_DIR}/src/node-v0.99.96" "${CACHE_DIR}/src/iojs-v0.99.95"17}1819[ ! -e "${TEST_DIR}" ] && mkdir -p "${TEST_DIR}"20
18 unmodified lines
39try nvm_ls_cached "999.999"40[ -z "$CAPTURED_STDOUT" ] \41 || die "nvm_ls_cached '999.999' should return empty; got '$CAPTURED_STDOUT'"4243# nvm_ls_cached can currently only see bin-cached node artifacts: bin-cached44# io.js, and src-cached anything, are invisible to it - and thus to45# `--offline` version resolution46CACHE_DIR="$(nvm_cache_dir)"47SUFFIX="$(nvm_get_os)-$(nvm_get_arch)"48mkdir -p "${CACHE_DIR}/bin/node-v0.99.98-${SUFFIX}" "${CACHE_DIR}/bin/iojs-v0.99.97-${SUFFIX}" \49 "${CACHE_DIR}/src/node-v0.99.96" "${CACHE_DIR}/src/iojs-v0.99.95"5051try nvm_ls_cached "v0.99.98"52[ "_$CAPTURED_STDOUT" = "_v0.99.98" ] \53 || die "nvm_ls_cached 'v0.99.98' should find the bin-cached node version; got '$CAPTURED_STDOUT'"5455try nvm_ls_cached "iojs-v0.99.97"56[ -z "$CAPTURED_STDOUT" ] \57 || die "nvm_ls_cached 'iojs-v0.99.97' should not see the bin-cached io.js version; got '$CAPTURED_STDOUT'"5859try nvm_ls_cached "v0.99.96"60[ -z "$CAPTURED_STDOUT" ] \61 || die "nvm_ls_cached 'v0.99.96' should not see the src-cached node version; got '$CAPTURED_STDOUT'"6263try nvm_ls_cached "iojs-v0.99.95"64[ -z "$CAPTURED_STDOUT" ] \65 || die "nvm_ls_cached 'iojs-v0.99.95' should not see the src-cached io.js version; got '$CAPTURED_STDOUT'"6667# ... and so nvm_offline_version can not resolve them68try nvm_offline_version "iojs-v0.99.95"69[ "_$CAPTURED_STDOUT" = "_N/A" ] \70 || die "nvm_offline_version 'iojs-v0.99.95' should not resolve the src-cached io.js version; got '$CAPTURED_STDOUT'"71[ "_$CAPTURED_EXIT_CODE" = "_3" ] \72 || die "nvm_offline_version 'iojs-v0.99.95' should exit 3; got '$CAPTURED_EXIT_CODE'"7374cleanup