Skip to content

Instantly share code, notes, and snippets.

@mpapis
Forked from VladRassokhin/rvm-shell-test-runnner.sh
Created September 13, 2012 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpapis/3712529 to your computer and use it in GitHub Desktop.
Save mpapis/3712529 to your computer and use it in GitHub Desktop.
Test for .rvmrc formats detection in rvm-shell

tf --text rvm-shell_comment_test.sh:

##### starting test rvm-shell.
$ source "$rvm_path/scripts/rvm"
$ : prepare
$ d=${TMPDIR:=/tmp}/test-rvm-shell/
# passed: status = 0
$ mkdir -p $d
# passed: status = 0
$ echo "rvm current" > $d/rvm-shell-rvm-current-script.sh
# passed: status = 0
$ chmod +x $d/rvm-shell-rvm-current-script.sh
$ rvm use system
Now using system ruby.
Running /home/mpapis/.rvm/hooks/after_use
$ : Test1
$ echo "rvm use 1.9.3-p194@acme --create" > $d/.rvmrc
# passed: status = 0
$ ls -ld $d/.rvmrc
-rw-rw-r-- 1 mpapis users 33 Sep 13 09:31 /tmp/test-rvm-shell//.rvmrc
$ rvm rvmrc trust $d/.rvmrc
Marked /home/mpapis/tmp/.rvmrc as trusted - failed
# passed: status = 0
$ rvm $d do rvm current
ruby-1.9.3-p194@acme
# passed: match = /ruby-1.9.3-p194@acme/
$ rvm-shell --path $d -c "rvm current"
ruby-1.9.3-p194@acme
# passed: match = /ruby-1.9.3-p194@acme/
$ rvm $d do $d/rvm-shell-rvm-current-script.sh
ruby-1.9.3-p194@acme
# passed: match = /ruby-1.9.3-p194@acme/
$ rvm-shell --path $d $d/rvm-shell-rvm-current-script.sh
ruby-1.9.3-p194@acme
# passed: match = /ruby-1.9.3-p194@acme/
$ : Test2
$ rvm current
system
# passed: match = /system/
$ echo "rvm 1.9.3-p194@acme --create" > $d/.rvmrc
# passed: status = 0
$ ls -ld $d/.rvmrc
-rw-rw-r-- 1 mpapis users 29 Sep 13 09:31 /tmp/test-rvm-shell//.rvmrc
$ rvm rvmrc trust $d/.rvmrc
Marked /home/mpapis/tmp/.rvmrc as trusted - failed
# passed: status = 0
$ rvm $d do rvm current
ruby-1.9.3-p194@acme
# passed: match = /ruby-1.9.3-p194@acme/
$ rvm-shell --path $d -c "rvm current"
ruby-1.9.3-p194
# failed: match = /ruby-1.9.3-p194@acme/
$ rvm $d do $d/rvm-shell-rvm-current-script.sh
ruby-1.9.3-p194@acme
# passed: match = /ruby-1.9.3-p194@acme/
$ rvm-shell --path $d $d/rvm-shell-rvm-current-script.sh
ruby-1.9.3-p194
# failed: match = /ruby-1.9.3-p194@acme/
$ : Cleaning
$ rm -rf $d
# passed: status = 0
##### Processed commands 26 of 26, success tests 15 of 17, failure tests 2 of 17.
source "$rvm_path/scripts/rvm"
: prepare
d=${TMPDIR:=/tmp}/test-rvm-shell/ # status=0
mkdir -p $d # status=0
echo "rvm current" > $d/rvm-shell-rvm-current-script.sh # status=0
chmod +x $d/rvm-shell-rvm-current-script.sh
rvm use system
: Test1
echo "rvm use 1.9.3-p194@acme --create" > $d/.rvmrc # status=0
ls -ld $d/.rvmrc
rvm rvmrc trust $d/.rvmrc # status=0
rvm $d do rvm current # match=/ruby-1.9.3-p194@acme/
rvm-shell --path $d -c "rvm current" # match=/ruby-1.9.3-p194@acme/
rvm $d do $d/rvm-shell-rvm-current-script.sh # match=/ruby-1.9.3-p194@acme/
rvm-shell --path $d $d/rvm-shell-rvm-current-script.sh # match=/ruby-1.9.3-p194@acme/
: Test2
echo "rvm 1.9.3-p194@acme --create" > $d/.rvmrc # status=0
ls -ld $d/.rvmrc
rvm rvmrc trust $d/.rvmrc # status=0
rvm $d do rvm current # match=/ruby-1.9.3-p194@acme/
rvm-shell --path $d -c "rvm current" # match=/ruby-1.9.3-p194@acme/
rvm $d do $d/rvm-shell-rvm-current-script.sh # match=/ruby-1.9.3-p194@acme/
rvm-shell --path $d $d/rvm-shell-rvm-current-script.sh # match=/ruby-1.9.3-p194@acme/
: Cleaning
rm -rf $d # status=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment