Skip to content
Myr

nvm_remote_version

This file

Path

test/fast/Unit tests/nvm_remote_version

91 lines · 3.6 KiB

Last changed by

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

History of this file

Take it

The walk stopped after 200 commits: lines older than 5c12680 point at it.

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 1–8why, one step back
1#!/bin/sh
23die () { echo "$@" ; cleanup ; exit 1; }45cleanup() {6 unset -f nvm_ls_remote nvm_ls_remote_iojs7}8

[Tests] set `$_` before sourcing `nvm.sh` in fast testsJordan Harbandbefore adoptionc451e7a

line 9why, one step back
9: nvm.sh

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 10–11why, one step back
10\. ../../../nvm.sh
11

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 12–13why, one step back
12\. ../../common.sh
13

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 14–16why, one step back
14nvm_ls_remote() {
15 echo "N/A"16}

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 17–19why, one step back
17try nvm_remote_version foo
18[ "_$CAPTURED_STDOUT" = "_N/A" ] || die "nonexistent version did not report N/A"19[ "_$CAPTURED_EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $CAPTURED_EXIT_CODE"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 20–23why, one step back
20
21nvm_ls_remote_iojs() {22 echo "N/A"23}

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 24–26why, one step back
24try nvm_remote_version iojs-foo
25[ "_$CAPTURED_STDOUT" = "_N/A" ] || die "nonexistent version did not report N/A"26[ "_$CAPTURED_EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $CAPTURED_EXIT_CODE"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 27–42why, one step back
27
2829nvm_ls_remote() {30 if [ -z "$1" ] || ! nvm_is_iojs_version "$1"; then31 echo "test_output"32 echo "more_test_output"33 echo "pattern_received:_$1_"34 fi35}36nvm_ls_remote_iojs() {37 if [ -z "$1" ] || nvm_is_iojs_version "$1"; then38 echo "test_iojs_output"39 echo "more_iojs_test_output"40 echo "iojs_pattern_received:_$1_"41 fi42}

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 43–46why, one step back
43try nvm_remote_version foo
44[ "_$CAPTURED_STDOUT" = "_pattern_received:_foo_" ] \45 || die "nvm_remote_version foo did not return last line only of nvm_ls_remote foo; got $CAPTURED_STDOUT"46[ "_$CAPTURED_EXIT_CODE" = "_0" ] || die "nvm_remote_version foo did not exit with 0, got $CAPTURED_EXIT_CODE"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 47why, one step back
47

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 48–51why, one step back
48try nvm_remote_version iojs-foo
49[ "_$CAPTURED_STDOUT" = "_iojs_pattern_received:_iojs-foo_" ] \50 || die "nvm_remote_version iojs-foo did not return last line only of nvm_ls_remote_iojs foo; got $CAPTURED_STDOUT"51[ "_$CAPTURED_EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs-foo did not exit with 0, got $CAPTURED_EXIT_CODE"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 52why, one step back
52

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 53–56why, one step back
53try nvm_remote_version iojs
54[ "_$CAPTURED_STDOUT" = "_iojs_pattern_received:__" ] \55 || die "nvm_remote_version iojs did not return last line only of nvm_ls_remote_iojs; got $CAPTURED_STDOUT"56[ "_$CAPTURED_EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs did not exit with 0, got $CAPTURED_EXIT_CODE"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 57why, one step back
57

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 58–61why, one step back
58try nvm_remote_version stable
59[ "_$CAPTURED_STDOUT" = "_$(nvm_ls_remote stable)" ] \60 || die "nvm_remote_version stable did not return contents of nvm_ls_remote stable; got $CAPTURED_STDOUT"61[ "_$CAPTURED_EXIT_CODE" = "_0" ] || die "nvm_remote_version stable did not exit with 0, got $CAPTURED_EXIT_CODE"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 62why, one step back
62

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 63–66why, one step back
63try nvm_remote_version unstable
64[ "_$CAPTURED_STDOUT" = "_$(nvm_ls_remote unstable)" ] \65 || die "nvm_remote_version unstable did not return contents of nvm_ls_remote unstable; got $CAPTURED_STDOUT"66[ "_$CAPTURED_EXIT_CODE" = "_0" ] || die "nvm_remote_version unstable did not exit with 0, got $CAPTURED_EXIT_CODE"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 67why, one step back
67

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 68–71why, one step back
68try nvm_remote_version node
69[ "_$CAPTURED_STDOUT" = "_$(nvm_ls_remote node)" ] \70 || die "nvm_remote_version node did not return contents of nvm_ls_remote node; got $CAPTURED_STDOUT"71[ "_$CAPTURED_EXIT_CODE" = "_0" ] || die "nvm_remote_version node did not exit with 0, got $CAPTURED_EXIT_CODE"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 72why, one step back
72

[Fix] Reject bare LTS codenames in nvm installRahul Beniwalbefore adoption81f1363

lines 73–79why, one step back
73# Test LTS name rejection (Issue #3474)
74# When nvm_remote_versions returns a line with LTS name in description,75# nvm_remote_version should reject it if the pattern doesn't match the version number7677nvm_remote_versions() {78 echo "v4.9.1 Argon *"79}

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 80–82why, one step back
80try nvm_remote_version Argon
81[ "_$CAPTURED_STDOUT" = "_N/A" ] || die "nvm_remote_version Argon should return N/A (LTS name not in version), got $CAPTURED_STDOUT"82[ "_$CAPTURED_EXIT_CODE" = "_3" ] || die "nvm_remote_version Argon should exit with code 3, got $CAPTURED_EXIT_CODE"

[Fix] Reject bare LTS codenames in nvm installRahul Beniwalbefore adoption81f1363

lines 83–86why, one step back
83
84nvm_remote_versions() {85 echo "v4.9.1"86}

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 87–89why, one step back
87try nvm_remote_version 4
88[ "_$CAPTURED_STDOUT" = "_v4.9.1" ] || die "nvm_remote_version 4 should return v4.9.1, got $CAPTURED_STDOUT"89[ "_$CAPTURED_EXIT_CODE" = "_0" ] || die "nvm_remote_version 4 should exit with code 0, got $CAPTURED_EXIT_CODE"

[Fix] Reject bare LTS codenames in nvm installRahul Beniwalbefore adoption81f1363

line 90why, one step back
90

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 91why, one step back
91cleanup