[Tests] update most mkdirs to use make_fake_{node,iojs}

Joshua Li 2018-06-13 10:38:19 -07:00 committed by Jordan Harband
parent eabd7ab13d
commit a5f42d9cea
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
21 changed files with 107 additions and 90 deletions

View File

@ -14,9 +14,9 @@ cleanup () {
rm -rf "${NVM_DIR}/versions/io.js/v0.2.1"
}
mkdir "${NVM_DIR}/v0.8.1"
mkdir "${NVM_DIR}/v0.9.1"
mkdir -p "${NVM_DIR}/versions/io.js/v0.2.1"
make_fake_node v0.8.1
make_fake_node v0.9.1
make_fake_iojs v0.2.1
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"

View File

@ -1,10 +1,11 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
mkdir -p "${NVM_DIR}/v0.0.2"
mkdir -p "${NVM_DIR}/v0.0.20"
mkdir -p "${NVM_DIR}/versions/node/v0.12.0"
make_fake_node v0.0.2
make_fake_node v0.0.20
make_fake_node v0.12.0
die () { echo "$@" ; exit 1; }

View File

@ -1,9 +1,10 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/v0.0.2"
mkdir "${NVM_DIR}/v0.0.20"
make_fake_node v0.0.2
make_fake_node v0.0.20
die () { echo "$@" ; exit 1; }

View File

@ -1,10 +1,11 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
mkdir "${NVM_DIR}/v0.20.3"
make_fake_node v0.1.3
make_fake_node v0.2.3
make_fake_node v0.20.3
die () { echo "$@" ; exit 1; }

View File

@ -1,11 +1,12 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
die () { echo "$@" ; exit 1; }
mkdir "${NVM_DIR}/v0.2.3"
mkdir "${NVM_DIR}/v0.3.3"
make_fake_node v0.2.3
make_fake_node v0.3.3
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"
@ -19,10 +20,10 @@ nvm ls stable | \grep "$STABLE_VERSION" >/dev/null \
nvm ls unstable | \grep "$UNSTABLE_VERSION" >/dev/null \
|| die "expected 'nvm ls unstable' to give $UNSTABLE_VERSION, got $(nvm ls unstable)"
mkdir "${NVM_DIR}/v0.1.2"
make_fake_node v0.1.4
nvm alias stable 0.1
nvm ls stable | \grep -v "$STABLE_VERSION" >/dev/null \
|| die "'nvm ls stable' contained $STABLE_VERSION instead of v0.1.2"
nvm ls stable | \grep v0.1.2 >/dev/null \
|| die "'nvm ls stable' did not contain v0.1.2"
|| die "'nvm ls stable' contained $STABLE_VERSION instead of v0.1.4"
nvm ls stable | \grep v0.1.4 >/dev/null \
|| die "'nvm ls stable' did not contain v0.1.4"

View File

@ -3,13 +3,14 @@
die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh
\. ../../common.sh
mkdir -p "${NVM_DIR}/v0.0.1"
mkdir -p "${NVM_DIR}/v0.0.3"
mkdir -p "${NVM_DIR}/v0.0.9"
mkdir -p "${NVM_DIR}/v0.3.1"
mkdir -p "${NVM_DIR}/v0.3.3"
mkdir -p "${NVM_DIR}/v0.3.9"
make_fake_node v0.0.1
make_fake_node v0.0.3
make_fake_node v0.0.9
make_fake_node v0.3.1
make_fake_node v0.3.3
make_fake_node v0.3.9
nvm_has_system_node() { return 0; }
nvm ls system | grep system 2>&1 > /dev/null

View File

@ -1,24 +1,27 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/v0.0.1"
mkdir "${NVM_DIR}/v0.0.3"
mkdir "${NVM_DIR}/v0.0.9"
mkdir "${NVM_DIR}/v0.3.1"
mkdir "${NVM_DIR}/v0.3.3"
mkdir "${NVM_DIR}/v0.3.9"
mkdir -p "${NVM_DIR}/versions/node/v0.12.87"
mkdir -p "${NVM_DIR}/versions/node/v0.12.9"
mkdir -p "${NVM_DIR}/versions/io.js/v0.1.2"
mkdir -p "${NVM_DIR}/versions/io.js/v0.10.2"
die () { echo "$@" ; exit 1; }
make_fake_node v0.0.1
make_fake_node v0.0.3
make_fake_node v0.0.9
make_fake_node v0.3.1
make_fake_node v0.3.3
make_fake_node v0.3.9
make_fake_node v0.12.87
make_fake_node v0.12.9
make_fake_iojs v0.1.2
make_fake_iojs v0.10.2
# The result should contain the version numbers.
nvm ls | grep v0.0.1 >/dev/null &&
nvm ls | grep v0.0.3 >/dev/null &&
nvm ls | grep v0.0.9 >/dev/null &&
nvm ls | grep v0.3.1 >/dev/null &&
nvm ls | grep v0.3.3 >/dev/null &&
nvm ls | grep v0.3.9 >/dev/null &&
nvm ls | grep v0.12.87 >/dev/null &&
nvm ls | grep iojs-v0.1.2 >/dev/null
nvm ls | grep v0.0.1 >/dev/null || die "v0.0.1 not found in: $(nvm ls)"
nvm ls | grep v0.0.3 >/dev/null || die "v0.0.3 not found in: $(nvm ls)"
nvm ls | grep v0.0.9 >/dev/null || die "v0.0.9 not found in: $(nvm ls)"
nvm ls | grep v0.3.1 >/dev/null || die "v0.3.1 not found in: $(nvm ls)"
nvm ls | grep v0.3.3 >/dev/null || die "v0.3.3 not found in: $(nvm ls)"
nvm ls | grep v0.3.9 >/dev/null || die "v0.3.9 not found in: $(nvm ls)"
nvm ls | grep v0.12.87 >/dev/null || die "v0.12.87 not found in: $(nvm ls)"
nvm ls | grep iojs-v0.1.2 >/dev/null || die "iojs-v0.1.2 not found in: $(nvm ls)"

View File

@ -1,9 +1,10 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
make_fake_node v0.1.3
make_fake_node v0.2.3
[ -z `nvm ls | grep '^ *\.'` ]
# The result should contain only the appropriate version numbers.

View File

@ -1,10 +1,10 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
mkdir -p "${NVM_DIR}/versions/node"
make_fake_node v0.1.3
make_fake_node v0.2.3
[ -z "$(nvm ls | \grep 'versions')" ]
# The result should contain only the appropriate version numbers.

View File

@ -3,13 +3,14 @@
die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh
\. ../../common.sh
mkdir -p "${NVM_DIR}/v0.0.1"
mkdir -p "${NVM_DIR}/v0.0.3"
mkdir -p "${NVM_DIR}/v0.0.9"
mkdir -p "${NVM_DIR}/v0.3.1"
mkdir -p "${NVM_DIR}/v0.3.3"
mkdir -p "${NVM_DIR}/v0.3.9"
make_fake_node v0.0.1
make_fake_node v0.0.3
make_fake_node v0.0.9
make_fake_node v0.3.1
make_fake_node v0.3.3
make_fake_node v0.3.9
nvm_has_system_node() { return 0; }
nvm ls | grep system 2>&1 > /dev/null

View File

@ -3,9 +3,10 @@
die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh
\. ../../common.sh
mkdir -p "${NVM_DIR}/versions/node/v0.12.1"
mkdir "${NVM_DIR}/v0.1.3"
make_fake_node v0.12.1
make_fake_node v0.1.3
nvm ls 0.12 | grep v0.12.1 || die '"nvm ls" did not list a version in the versions/ directory'
nvm ls 0.1 | grep v0.1.3 || die '"nvm ls" did not list a version not in the versions/ directory'

View File

@ -1,8 +1,9 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/v0.1.2"
make_fake_node v0.1.2
nvm ls v0.1 | grep v0.1.2 &&
nvm ls v0.1.2 | grep v0.1.2 &&

View File

@ -1,17 +1,18 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/v0.0.1"
mkdir "${NVM_DIR}/v0.0.3"
mkdir "${NVM_DIR}/v0.0.9"
mkdir "${NVM_DIR}/v0.3.1"
mkdir "${NVM_DIR}/v0.3.3"
mkdir "${NVM_DIR}/v0.3.9"
mkdir -p "${NVM_DIR}/versions/node/v0.12.87"
mkdir -p "${NVM_DIR}/versions/node/v0.12.9"
mkdir -p "${NVM_DIR}/versions/io.js/v0.1.2"
mkdir -p "${NVM_DIR}/versions/io.js/v0.10.2"
make_fake_node v0.0.1
make_fake_node v0.0.3
make_fake_node v0.0.9
make_fake_node v0.3.1
make_fake_node v0.3.3
make_fake_node v0.3.9
make_fake_node v0.12.87
make_fake_node v0.12.9
make_fake_iojs v0.1.2
make_fake_iojs v0.10.2
set -e

View File

@ -5,6 +5,7 @@ rmdir ../../../v0.0.9 >/dev/null 2>&1
rmdir ../../../v0.0.20 >/dev/null 2>&1
rmdir ../../../v0.1.2 >/dev/null 2>&1
rmdir ../../../v0.1.3 >/dev/null 2>&1
rmdir ../../../v0.1.4 >/dev/null 2>&1
rmdir ../../../v0.2.3 >/dev/null 2>&1
rmdir ../../../v0.3.1 >/dev/null 2>&1
rmdir ../../../v0.3.3 >/dev/null 2>&1

View File

@ -8,8 +8,9 @@ cleanup () {
}
\. ../../nvm.sh
\. ../common.sh
mkdir "${NVM_DIR}/v0.10.4"
make_fake_node v0.10.4
nvm deactivate >/dev/null 2>&1

View File

@ -4,11 +4,12 @@ set -ex
export NVM_SYMLINK_CURRENT=true
\. ../../nvm.sh
\. ../common.sh
rm -rf "${NVM_DIR}/v0.10.29"
mkdir "${NVM_DIR}/v0.10.29"
make_fake_node v0.10.29
nvm use --delete-prefix 0.10.29
rmdir "${NVM_DIR}/v0.10.29"
rm -rf "${NVM_DIR}/v0.10.29"
if [ ! -L "${NVM_DIR}/current" ];then
echo "Expected 'current' symlink to be created!"
@ -23,9 +24,9 @@ if [ "$(basename "${oldLink}")" != 'v0.10.29' ];then
fi
rm -rf "${NVM_DIR}/v0.11.13"
mkdir "${NVM_DIR}/v0.11.13"
make_fake_node v0.11.13
nvm use --delete-prefix 0.11.13
rmdir "${NVM_DIR}/v0.11.13"
rm -rf "${NVM_DIR}/v0.11.13"
newLink="$(readlink "${NVM_DIR}/current")"

View File

@ -3,6 +3,7 @@
set -ex
\. ../../nvm.sh
\. ../common.sh
TEST_NODE_VERSION="v0.10.29"
@ -35,9 +36,9 @@ cleanup() {
}
runNvmUse() {
mkdir "${NVM_DIR}/${TEST_NODE_VERSION}"
make_fake_node "$TEST_NODE_VERSION"
nvm use --delete-prefix "${TEST_NODE_VERSION}" > /dev/null 2>&1
rmdir "${NVM_DIR}/${TEST_NODE_VERSION}"
rm -rf "${NVM_DIR}/${TEST_NODE_VERSION}"
}
isCurrentSymlinkPresent() {

View File

@ -7,8 +7,9 @@ cleanup () {
}
\. ../../../nvm.sh
\. ../../common.sh
mkdir -p "$(nvm_version_path v0.1.2)"
make_fake_node v0.1.2
OUTPUT="$(nvm_ensure_version_installed foo 2>&1)"
EXIT_CODE=$?

View File

@ -1,17 +1,14 @@
#!/bin/sh
cleanup () {
rm "${NVM_DIR}/versions/io.js/v0.1.2/node"
rm "${NVM_DIR}/versions/io.js/v0.1.2/iojs"
rmdir "${NVM_DIR}/versions/io.js/v0.1.2"
rm -rf "${NVM_DIR}/versions/io.js/v0.1.2"
}
die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/versions/io.js/v0.1.2"
touch "${NVM_DIR}/versions/io.js/v0.1.2/node"
touch "${NVM_DIR}/versions/io.js/v0.1.2/iojs"
make_fake_iojs v0.1.2
nvm use iojs-v0.1.2

View File

@ -1,14 +1,14 @@
#!/bin/sh
\. ../../../nvm.sh
\. ../../common.sh
cleanup () {
rm -rf "${NVM_DIR}/v0.1.2/node"
rm -rf "${NVM_DIR}/v0.1.2"
}
die () { echo "$@" ; exit 1; }
mkdir "${NVM_DIR}/v0.1.2"
touch "${NVM_DIR}/v0.1.2/node"
make_fake_node v0.1.2
nvm use 0.1.2

View File

@ -14,13 +14,14 @@ cleanup() {
}
\. ../../../nvm.sh
\. ../../common.sh
mkdir "${NVM_DIR}/v0.2.3"
mkdir "${NVM_DIR}/v0.3.4"
mkdir "${NVM_DIR}/v0.4.6"
mkdir "${NVM_DIR}/v0.5.7"
mkdir "${NVM_DIR}/v0.7.7"
mkdir -p "${NVM_DIR}/versions/io.js/v0.98.0"
make_fake_node v0.2.3
make_fake_node v0.3.4
make_fake_node v0.4.6
make_fake_node v0.5.7
make_fake_node v0.7.7
make_fake_iojs v0.98.0
LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
[ "_$LATEST_STABLE" = "_0.4" ] || die "local stable is not latest even minor: expected 0.4, got $LATEST_STABLE"
@ -35,8 +36,9 @@ LATEST_IOJS="$(nvm_print_implicit_alias local iojs)"
[ "_$LATEST_IOJS" = "_iojs-v0.98" ] || die "local iojs is not latest iojs: expected iojs-v0.98, got $LATEST_IOJS"
## node post v1.0/io.js merger ##
mkdir -p "${NVM_DIR}/versions/node/v1.0.0"
mkdir -p "${NVM_DIR}/versions/node/v1.1.0"
make_fake_node v1.0.0
make_fake_node v1.1.0
LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
[ "_$LATEST_STABLE" = "_1.1" ] || die "local stable when post-v1.0 exists is not latest: expected 1.1, got $LATEST_STABLE"