|
3 | 3 | die () { echo "$@" ; cleanup ; exit 1; }
|
4 | 4 | cleanup () {
|
5 | 5 | rm -rf "$(nvm_version_path v0.1.2)"
|
| 6 | + unset -f nvm_has_system_node nvm_has_system_iojs |
6 | 7 | }
|
7 | 8 |
|
8 | 9 | \. ../../../nvm.sh
|
@@ -31,4 +32,31 @@ You need to run "nvm install iojs" to install it before using it.'
|
31 | 32 | [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed iojs' to give $EXPECTED_OUTPUT, got $OUTPUT"
|
32 | 33 | [ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed iojs' to exit with 1, got $EXIT_CODE"
|
33 | 34 |
|
| 35 | +nvm_has_system_node() { return 1; } |
| 36 | +nvm_has_system_iojs() { return 1; } |
| 37 | + |
| 38 | +OUTPUT="$(nvm_ensure_version_installed system 2>&1)" |
| 39 | +EXIT_CODE=$? |
| 40 | +EXPECTED_OUTPUT='N/A: no system version of node/io.js is installed.' |
| 41 | +[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with neither installed to give $EXPECTED_OUTPUT, got $OUTPUT" |
| 42 | +[ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed system' with neither installed to exit with 1, got $EXIT_CODE" |
| 43 | + |
| 44 | +nvm_has_system_node() { return 0; } |
| 45 | +nvm_has_system_iojs() { return 1; } |
| 46 | + |
| 47 | +OUTPUT="$(nvm_ensure_version_installed system 2>&1)" |
| 48 | +EXIT_CODE=$? |
| 49 | +EXPECTED_OUTPUT='' |
| 50 | +[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with node installed to give $EXPECTED_OUTPUT, got $OUTPUT" |
| 51 | +[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm_ensure_version_installed system' with node installed to exit with 0, got $EXIT_CODE" |
| 52 | + |
| 53 | +nvm_has_system_node() { return 1; } |
| 54 | +nvm_has_system_iojs() { return 0; } |
| 55 | + |
| 56 | +OUTPUT="$(nvm_ensure_version_installed system 2>&1)" |
| 57 | +EXIT_CODE=$? |
| 58 | +EXPECTED_OUTPUT='' |
| 59 | +[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with iojs installed to give $EXPECTED_OUTPUT, got $OUTPUT" |
| 60 | +[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm_ensure_version_installed system' with iojs installed to exit with 0, got $EXIT_CODE" |
| 61 | + |
34 | 62 | cleanup
|
0 commit comments