mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	Fix nvm alias tests to have both stable and unstable mocks.
				
					
				
			This commit is contained in:
		| @@ -1,4 +1,4 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
|  |  | ||||||
| . ../../../nvm.sh | . ../../../nvm.sh | ||||||
| [ $(nvm alias test1 | wc -l) = '2' ] | [ $(nvm alias test-stable-1 | wc -l) = '2' ] | ||||||
|   | |||||||
| @@ -5,24 +5,44 @@ | |||||||
| die () { echo $@ ; exit 1; } | die () { echo $@ ; exit 1; } | ||||||
|  |  | ||||||
| NVM_ALIAS_OUTPUT=$(nvm alias) | NVM_ALIAS_OUTPUT=$(nvm alias) | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test1 -> 0.0.1 (-> v0.0.1)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-1 -> 0.0.1 (-> v0.0.1)$' \ | ||||||
|   || die "did not find test1 alias" |   || die "did not find test-stable-1 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test2 -> 0.0.2 (-> v0.0.2)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-2 -> 0.0.2 (-> v0.0.2)$' \ | ||||||
|   || die "did not find test2 alias" |   || die "did not find test-stable-2 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test3 -> 0.0.3 (-> v0.0.3)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-3 -> 0.0.3 (-> v0.0.3)$' \ | ||||||
|   || die "did not find test3 alias" |   || die "did not find test-stable-3 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test4 -> 0.0.4 (-> v0.0.4)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-4 -> 0.0.4 (-> v0.0.4)$' \ | ||||||
|   || die "did not find test4 alias" |   || die "did not find test-stable-4 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test5 -> 0.0.5 (-> v0.0.5)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-5 -> 0.0.5 (-> v0.0.5)$' \ | ||||||
|   || die "did not find test5 alias" |   || die "did not find test-stable-5 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test6 -> 0.0.6 (-> v0.0.6)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-6 -> 0.0.6 (-> v0.0.6)$' \ | ||||||
|   || die "did not find test6 alias" |   || die "did not find test-stable-6 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test7 -> 0.0.7 (-> v0.0.7)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-7 -> 0.0.7 (-> v0.0.7)$' \ | ||||||
|   || die "did not find test7 alias" |   || die "did not find test-stable-7 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test8 -> 0.0.8 (-> v0.0.8)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-8 -> 0.0.8 (-> v0.0.8)$' \ | ||||||
|   || die "did not find test8 alias" |   || die "did not find test-stable-8 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test9 -> 0.0.9 (-> v0.0.9)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-9 -> 0.0.9 (-> v0.0.9)$' \ | ||||||
|   || die "did not find test9 alias" |   || die "did not find test-stable-9 alias" | ||||||
| echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test10 -> 0.0.10 (-> v0.0.10)$' \ | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-stable-10 -> 0.0.10 (-> v0.0.10)$' \ | ||||||
|   || die "did not find test10 alias" |   || die "did not find test-stable-10 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-1 -> 0.1.1 (-> v0.1.1)$' \ | ||||||
|  |   || die "did not find test-unstable-1 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-2 -> 0.1.2 (-> v0.1.2)$' \ | ||||||
|  |   || die "did not find test-unstable-2 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-3 -> 0.1.3 (-> v0.1.3)$' \ | ||||||
|  |   || die "did not find test-unstable-3 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-4 -> 0.1.4 (-> v0.1.4)$' \ | ||||||
|  |   || die "did not find test-unstable-4 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-5 -> 0.1.5 (-> v0.1.5)$' \ | ||||||
|  |   || die "did not find test-unstable-5 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-6 -> 0.1.6 (-> v0.1.6)$' \ | ||||||
|  |   || die "did not find test-unstable-6 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-7 -> 0.1.7 (-> v0.1.7)$' \ | ||||||
|  |   || die "did not find test-unstable-7 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-8 -> 0.1.8 (-> v0.1.8)$' \ | ||||||
|  |   || die "did not find test-unstable-8 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-9 -> 0.1.9 (-> v0.1.9)$' \ | ||||||
|  |   || die "did not find test-unstable-9 alias" | ||||||
|  | echo "$NVM_ALIAS_OUTPUT" | \grep -e '^test-unstable-10 -> 0.1.10 (-> v0.1.10)$' \ | ||||||
|  |   || die "did not find test-unstable-10 alias" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,6 +2,8 @@ | |||||||
|  |  | ||||||
| for i in $(seq 1 10) | for i in $(seq 1 10) | ||||||
|   do |   do | ||||||
|   echo 0.0.$i > ../../../alias/test$i |   echo 0.0.$i > ../../../alias/test-stable-$i | ||||||
|   mkdir -p ../../../v0.0.$i |   mkdir -p ../../../v0.0.$i | ||||||
|  |   echo 0.1.$i > ../../../alias/test-unstable-$i | ||||||
|  |   mkdir -p ../../../v0.1.$i | ||||||
| done | done | ||||||
|   | |||||||
| @@ -2,8 +2,10 @@ | |||||||
|  |  | ||||||
| for i in $(seq 1 10) | for i in $(seq 1 10) | ||||||
|   do |   do | ||||||
|   rm -f "../../../alias/test$i" |   rm -f "../../../alias/test-stable-$i" | ||||||
|   rm -rf "../../../v0.0.$i" |   rm -rf "../../../v0.0.$i" | ||||||
|  |   rm -f "../../../alias/test-unstable-$i" | ||||||
|  |   rm -rf "../../../v0.1.$i" | ||||||
| done | done | ||||||
|  |  | ||||||
| rm -f "../../../alias/stable" | rm -f "../../../alias/stable" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user