mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-07-18 21:08:23 +08:00
[Tests] `nvm_alias`: add edge-case tests for hostile file content
18 lines
427 B
Bash
Executable File
18 lines
427 B
Bash
Executable File
#!/bin/sh
|
|
|
|
die () { echo "$@" ; exit 1; }
|
|
|
|
export NVM_DIR="$(cd ../../.. && pwd)"
|
|
|
|
: nvm.sh
|
|
\. "${NVM_DIR}/nvm.sh"
|
|
|
|
# Create an alias file whose name contains spaces
|
|
mkdir -p ../../../alias
|
|
printf 'v22.1.0\n' > "../../../alias/test edge spaces"
|
|
ACTUAL="$(nvm_alias "test edge spaces")"
|
|
EXPECTED='v22.1.0'
|
|
[ "${ACTUAL}" = "${EXPECTED}" ] || die "expected >${EXPECTED}<, got >${ACTUAL}<"
|
|
|
|
rm -f "../../../alias/test edge spaces"
|