Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
adding more tests for cache, uberjar
  • Loading branch information
jkutner committed Nov 26, 2014
1 parent 881964d commit f7f6673
Showing 1 changed file with 47 additions and 6 deletions.
53 changes: 47 additions & 6 deletions test/compile_test.sh
Expand Up @@ -2,7 +2,7 @@

. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh

_createNoLeinProject() {
_createBaseProject() {
cat > ${BUILD_DIR}/project.clj <<EOF
(defproject sample "0.1.0-SNAPSHOT"
:description "FIXME: write description"
Expand All @@ -28,7 +28,7 @@ EOF

_createLein2ProjectFile() {
cat > ${BUILD_DIR}/project.clj <<EOF
(defproject sample "0.1.0-SNAPSHOT"
(defproject sample "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
Expand All @@ -41,6 +41,25 @@ _createLein2ProjectFile() {
EOF
}

_createUberJarProjectFile() {
cat > ${BUILD_DIR}/project.clj <<EOF
(defproject clojure-getting-started "1.0.0-SNAPSHOT"
:description "Demo Clojure web app"
:url "http://clojure-getting-started.herokuapp.com"
:license {:name "Eclipse Public License v1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.1.8"]
[ring/ring-jetty-adapter "1.2.2"]
[environ "0.5.0"]]
:min-lein-version "2.0.0"
:plugins [[environ/environ.lein "0.2.1"]]
:hooks [environ.leiningen.hooks]
:uberjar-name "clojure-getting-started-standalone.jar"
:profiles {:production {:env {:production true}}})
EOF
}

_createSysProps() {
local jdkVersion=${1:-"1.8"}
cat > ${BUILD_DIR}/system.properties <<EOF
Expand All @@ -51,7 +70,7 @@ EOF
# Tests

testCompileJdk6() {
_createNoLeinProject
_createBaseProject
_createSysProps "1.6"
compile
assertCapturedSuccess
Expand All @@ -60,7 +79,7 @@ testCompileJdk6() {
}

testCompileJdk7() {
_createNoLeinProject
_createBaseProject
_createSysProps "1.7"
compile
assertCapturedSuccess
Expand All @@ -69,20 +88,42 @@ testCompileJdk7() {
}

testCompileJdk8() {
_createNoLeinProject
_createBaseProject
compile
assertCapturedSuccess
assertCaptured "Installing OpenJDK 1.8...done"
assertCaptured "WARNING: no :min-lein-version found in project.clj; using 1.7.1."
assertCaptured "To use Leiningen 2.x, add this to project.clj: :min-lein-version \"2.0.0\""
assertCaptured "Downloading: leiningen-1.7.1-standalone.jar"
assertCaptured "No Procfile; using \"web: lein trampoline run\"."
}

testMinLeinVersion() {
_createNoLeinProject
_createBaseProject
_createLein2ProjectFile
compile
assertCapturedSuccess
assertNotCaptured "WARNING: no :min-lein-version found in project.clj; using 1.7.1."
assertCaptured "Downloading: leiningen-2.4.2-standalone.jar"
assertCaptured "No Procfile; using \"web: lein with-profile production trampoline run\"."
}

testUberJar() {
_createBaseProject
_createUberJarProjectFile
compile
assertCapturedSuccess
assertCaptured "Running: lein uberjar"
}

testCacheLein() {
_createBaseProject

compile
assertCapturedSuccess
assertNotCaptured "Using cached Leiningen"

compile
assertCapturedSuccess
assertCaptured "Using cached Leiningen"
}

0 comments on commit f7f6673

Please sign in to comment.