From 875716dc48cd5c485d2342c9e5bb1d461bc64b6d Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 20 Apr 2013 21:26:52 +0200 Subject: o Making the resolvers use app.resolved_version instead of app.version. o Making set-version update app.version. --- test/app-upgrade.bats | 40 ++++++++++++++++++++++++++++++++++++++++ test/utils.bash | 36 ++++++++++++++++++++++++++---------- 2 files changed, 66 insertions(+), 10 deletions(-) create mode 100755 test/app-upgrade.bats (limited to 'test') diff --git a/test/app-upgrade.bats b/test/app-upgrade.bats new file mode 100755 index 0000000..2dde851 --- /dev/null +++ b/test/app-upgrade.bats @@ -0,0 +1,40 @@ +#!/usr/bin/env bats +# vim: set filetype=sh: + +load utils + +@test "app-upgrade" { + mkzip app-a + install_artifact + + app init -d my-app maven -r "$FIXED_REPO_URL" org.example:app-a:1.0-SNAPSHOT; echo_lines + eq '$status' 0 + + cd my-app + app conf get maven.version + match '${lines[0]}' "1.0-SNAPSHOT" + maven_version="${lines[0]}" + describe maven_version=$maven_version + + app conf get app.version + match '${lines[0]}' "1.0-.*" + app_version="${lines[0]}" + describe app_version=$app_version + + app conf get app.resolved_version + match '${lines[0]}' "1.0-.*" + eq '${lines[0]}' "$app_version" + resolved_version="${lines[0]}" + describe resolved_version=$resolved_version + + install_artifact + + app upgrade; echo_lines + eq '$status' 0 + + app conf get app.resolved_version + match '${lines[0]}' "1.0-.*" + new_resolved_version="${lines[0]}" + describe new_resolved_version=$new_resolved_version + neq $new_resolved_version $resolved_version +} diff --git a/test/utils.bash b/test/utils.bash index cb2337b..ad80629 100644 --- a/test/utils.bash +++ b/test/utils.bash @@ -61,16 +61,16 @@ app_libexec() { run "$x" $@ } -fix_path=`uname -s` +fix_path_uname=`uname -s` fix_path() { - local path=$1 - - case $fix_path in + case $fix_path_uname in CYGWIN_NT*) - x=$(cygpath -wa $1) + cygpath -wa $1 + ;; + *) + echo $1 ;; esac - echo $x } describe() { @@ -100,8 +100,8 @@ can_not_read() { is_directory() { if [ ! -d "$1" ] then - echo "Not a directory: $1" 2>&1 - return 1 + echo "Not a directory: $1" 2>&1 + return 1 fi } @@ -112,7 +112,7 @@ eq() { if [[ $e == $a ]] then - return 0 + return 0 fi echo "Assertion failed: $ex" @@ -121,6 +121,22 @@ eq() { exit 1 } +neq() { + local ex="$1" + local e="$2" + local a="`eval echo $ex`" + + if [[ $e != $a ]] + then + return 0 + fi + + echo "Not-equal assertion failed: $ex" + echo "Expected: $e" + echo "Actual: $a" + exit 1 +} + match() { local ex="$1" local regex="$2" @@ -128,7 +144,7 @@ match() { if [[ $a =~ $regex ]] then - return 0 + return 0 fi echo "Assertion failed: $ex =~ $a" -- cgit v1.2.3