You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Bash
		
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Bash
		
	
#!/bin/sh
 | 
						|
 | 
						|
die () { echo $@ ; cleanup ; exit 1; }
 | 
						|
 | 
						|
cleanup() {
 | 
						|
  unset -f nvm_download
 | 
						|
}
 | 
						|
 | 
						|
. ../../../nvm.sh
 | 
						|
 | 
						|
# sample output at the time the test was written
 | 
						|
TAB_PATH="$PWD/iojs.org-dist-index.tab"
 | 
						|
nvm_download() {
 | 
						|
  cat "$TAB_PATH"
 | 
						|
}
 | 
						|
 | 
						|
OUTPUT="$(nvm_ls_remote_iojs foo)"
 | 
						|
EXIT_CODE="$(nvm_ls_remote_iojs foo >/dev/null 2>&1 ; echo $?)"
 | 
						|
[ "_$OUTPUT" = "_N/A" ] || die "nonexistent version did not report N/A"
 | 
						|
[ "_$EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $EXIT_CODE"
 | 
						|
 | 
						|
OUTPUT="$(nvm_ls_remote_iojs)"
 | 
						|
EXPECTED_OUTPUT="$(nvm_download | \egrep -o 'v[0-9]+\.[0-9]+\.[0-9]+' | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | sed -e 's/^/iojs-/')"
 | 
						|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "bare nvm_ls_remote_iojs did not output expected sorted versions; got $(echo "$OUTPUT") expected $(echo "$EXPECTED_OUTPUT")"
 | 
						|
 | 
						|
OUTPUT="$(nvm_ls_remote_iojs 1.0)"
 | 
						|
EXPECTED_OUTPUT="iojs-v1.0.0
 | 
						|
iojs-v1.0.1
 | 
						|
iojs-v1.0.2
 | 
						|
iojs-v1.0.3
 | 
						|
iojs-v1.0.4"
 | 
						|
 | 
						|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote_iojs 1.0 did not output 1.0.x versions; got $OUTPUT"
 | 
						|
 | 
						|
cleanup
 | 
						|
 |