Skip to content

Commit

Permalink
use assert(Not)Captured in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrainard committed Jan 20, 2012
1 parent 84edc6d commit 99a5a48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ testCompile()
assertTrue "SBT bin cache should have been unpacked" "[ -f ${BUILD_DIR}/.sbt_home/bin/testfile ]"
assertTrue "Ivy2 cache should exist" "[ -d ${BUILD_DIR}/.ivy2/cache ]"
assertFalse "Old SBT launch jar should have been deleted" "[ -f ${BUILD_DIR}/.sbt_home/bin/sbt-launch-OLD.jar ]"
assertFileContains "SBT should have been installed" "Building app with sbt" "${STD_OUT}"
assertCaptured "SBT should have been installed" "Building app with sbt"
assertFileMD5 "fa57b75cbc45763b7188a71928f4cd9a" "${BUILD_DIR}/.sbt_home/bin/sbt-launch-${DEFAULT_SBT_VERSION}.jar"
assertFileMD5 "13edddc0e7a326a8bce014363270b6cc" "${BUILD_DIR}/.sbt_home/bin/sbt.boot.properties"
assertFileMD5 "7fef33ac6fc019bb361fa85c7dc07f7c" "${BUILD_DIR}/.sbt_home/.sbt/plugins/Heroku-${DEFAULT_SBT_VERSION}.scala"
assertFileMD5 "13cf615379347d6f1ef10a4334f578f7" "${BUILD_DIR}/.sbt_home/.sbt/plugins/heroku-plugins-${DEFAULT_SBT_VERSION}.sbt"
assertEquals "SBT script should have been copied from buildpack and replaced old version" "" "$(diff ${BUILDPACK_HOME}/opt/sbt-${DEFAULT_SBT_VERSION} ${BUILD_DIR}/.sbt_home/bin/sbt)"

# run
assertFileContains "SBT tasks to run should be output" "Running: sbt clean compile stage" "${STD_OUT}"
assertFileContains "SBT should run stage task" "${SBT_STAGING_STRING}" "${STD_OUT}"
assertCaptured "SBT tasks to run should be output" "Running: sbt clean compile stage"
assertCaptured "SBT should run stage task" "${SBT_STAGING_STRING}"

# clean up
assertEquals "Ivy2 cache should have been repacked" "" "$(diff -r ${BUILD_DIR}/.sbt_home/.ivy2 ${CACHE_DIR}/.sbt_home/.ivy2)"
Expand All @@ -117,8 +117,8 @@ testCompile()
compile

assertCapturedSuccess
assertFileNotContains "SBT should not be re-installed on re-run" "Building app with sbt" "${STD_OUT}"
assertFileContains "SBT tasks to run should still be outputed" "Running: sbt clean compile stage" "${STD_OUT}"
assertNotCaptured "SBT should not be re-installed on re-run" "Building app with sbt"
assertCaptured "SBT tasks to run should still be outputed" "Running: sbt clean compile stage"
}

testCompile_WithNonDefaultVersion()
Expand All @@ -131,8 +131,8 @@ testCompile_WithNonDefaultVersion()
compile

assertCapturedSuccess
assertFileContains "Default version of SBT should always be installed" "Building app with sbt v${DEFAULT_SBT_VERSION}" "${STD_OUT}"
assertFileContains "Specified SBT version should actually be used" "Getting org.scala-tools.sbt sbt_2.9.1 ${specifiedSbtVersion}" "${STD_OUT}"
assertCaptured "Default version of SBT should always be installed" "Building app with sbt v${DEFAULT_SBT_VERSION}"
assertCaptured "Specified SBT version should actually be used" "Getting org.scala-tools.sbt sbt_2.9.1 ${specifiedSbtVersion}"
}

testCompile_BuildFailure()
Expand Down
2 changes: 1 addition & 1 deletion test/release_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ EOF`
release
assertCapturedSuccess
assertEquals "${expected_release_output}" "$(cat ${STD_OUT})"
assertCaptured "${expected_release_output}"
}

0 comments on commit 99a5a48

Please sign in to comment.