Skip to content

Commit

Permalink
add build.properties version check tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrainard committed Jan 13, 2012
1 parent 69e8bf9 commit f9eade8
Showing 1 changed file with 44 additions and 5 deletions.
49 changes: 44 additions & 5 deletions test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

# .sbt_home
# cache unpacking
# no project/build.properties
# no version 0.11.0 or greater
# use of -RC version
# making ivy2 cache
# only using one version of sbt even though build might specify others?
# installation of SBT if doesn't exist
Expand All @@ -26,9 +23,12 @@
# force with sbt.version??
# build.sbt: TaskKey[Unit]("stage") in Compile := { println("Hello Staging!") }

DEFAULT_SBT_VERSION="0.11.0"

testComplile()
setupSbt()
{
sbtVersion=${1:-${DEFAULT_SBT_VERSION}}

cat > ${BUILD_DIR}/blah.scala <<EOF
object Hi {
def main(args: Array[String]) = println("Hi!")
Expand All @@ -41,11 +41,50 @@ EOF

mkdir -p ${BUILD_DIR}/project
cat > ${BUILD_DIR}/project/build.properties <<EOF
sbt.version=0.11.0
sbt.version=${sbtVersion}
EOF
}

_testComplile()
{
setupSbt

compile

assertCapturedSuccess
assertFileContains "Hello Staging!" "${STD_OUT}"
}

testComplile_NoBuildPropertiesFile()
{
setupSbt
rm ${BUILD_DIR}/project/build.properties

compile

assertEquals "1" "${RETURN}"
assertFileContains "Error, your scala project must include project/build.properties and define sbt.version" "${STD_OUT}"
assertFileContains "You must use a release verison of sbt, sbt.version=${DEFAULT_SBT_VERSION} or greater" "${STD_OUT}"
}

testComplile_BuildPropertiesFileWithUnsupportedVersion()
{
setupSbt "0.10.0"

compile

assertEquals "1" "${RETURN}"
assertFileContains "Error, you have defined an unsupported sbt.version in project/build.properties" "${STD_OUT}"
assertFileContains "You must use a release verison of sbt, sbt.version=${DEFAULT_SBT_VERSION} or greater" "${STD_OUT}"
}

testComplile_BuildPropertiesFileWithUnsupportedVersion()
{
setupSbt "0.11.0-RC"

compile

assertEquals "1" "${RETURN}"
assertFileContains "Error, you have defined an unsupported sbt.version in project/build.properties" "${STD_OUT}"
assertFileContains "You must use a release verison of sbt, sbt.version=${DEFAULT_SBT_VERSION} or greater" "${STD_OUT}"
}

0 comments on commit f9eade8

Please sign in to comment.