aboutsummaryrefslogtreecommitdiff
path: root/test/test.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.scala')
-rw-r--r--test/test.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test.scala b/test/test.scala
index 7261287..242b639 100644
--- a/test/test.scala
+++ b/test/test.scala
@@ -10,6 +10,12 @@ object Main{
var successes = 0
var failures = 0
+ def assertException[T:scala.reflect.ClassTag](msg: String = "")(code: => Unit)(implicit logger: Logger) = {
+ try{
+ code
+ assert(false, msg)
+ }catch{ case _:AssertionError => }
+ }
def assert(condition: Boolean, msg: String = "")(implicit logger: Logger) = {
scala.util.Try{
Predef.assert(condition, "["++msg++"]")
@@ -82,6 +88,24 @@ object Main{
assert(cp.strings.distinct == cp.strings, "duplicates in classpath: " ++ cp.string)
}
+ // test that messed up artifacts crash with an assertion (which should tell the user what's up)
+ assertException[AssertionError](){
+ JavaDependency("com.jcraft", "jsch", " 0.1.53").classpath
+ }
+ assertException[AssertionError](){
+ JavaDependency("com.jcraft", null, "0.1.53").classpath
+ }
+ assertException[AssertionError](){
+ JavaDependency("com.jcraft", "", " 0.1.53").classpath
+ }
+ assertException[AssertionError](){
+ JavaDependency("com.jcraft%", "jsch", " 0.1.53").classpath
+ }
+ assertException[AssertionError](){
+ JavaDependency("", "jsch", " 0.1.53").classpath
+ }
+
+
System.err.println(" DONE!")
System.err.println( successes.toString ++ " succeeded, "++ failures.toString ++ " failed" )
if(failures > 0) System.exit(1) else System.exit(0)