From c44d861f1b53f4b8e35f72376c1fe8e67e8fd61d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9gis=20Blanc?= <regwblanc@gmail.com>
Date: Wed, 12 Dec 2012 22:18:00 +0100
Subject: [PATCH] run error tests

---
 .../XLangVerificationRegression.scala         | 20 ++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/test/scala/leon/test/verification/XLangVerificationRegression.scala b/src/test/scala/leon/test/verification/XLangVerificationRegression.scala
index 9509e0898..a22df5438 100644
--- a/src/test/scala/leon/test/verification/XLangVerificationRegression.scala
+++ b/src/test/scala/leon/test/verification/XLangVerificationRegression.scala
@@ -26,7 +26,7 @@ class XLangVerificationRegression extends FunSuite {
     xlang.FunctionClosure andThen
     leon.verification.AnalysisPhase
 
-  private def mkTest(file : File)(block: Output=>Unit) = {
+  private def mkTest(file : File, forError: Boolean = false)(block: Output=>Unit) = {
     val fullName = file.getPath()
     val start = fullName.indexOf("regression")
 
@@ -55,22 +55,32 @@ class XLangVerificationRegression extends FunSuite {
 
       val pipeline = mkPipeline
 
-      val report = pipeline.run(ctx)(file.getPath :: Nil)
+      if(forError) {
+        intercept[LeonFatalError]{
+          pipeline.run(ctx)(file.getPath :: Nil)
+        }
+      } else {
+
+        val report = pipeline.run(ctx)(file.getPath :: Nil)
+
+        block(Output(report, ctx.reporter))
+      }
 
-      block(Output(report, ctx.reporter))
     }
   }
 
-  private def forEachFileIn(cat : String)(block : Output=>Unit) {
+  private def forEachFileIn(cat : String, forError: Boolean = false)(block : Output=>Unit) {
     val fs = filesInResourceDir(
       "regression/verification/xlang/" + cat,
       _.endsWith(".scala"))
 
     for(f <- fs) {
-      mkTest(f)(block)
+      mkTest(f, forError)(block)
     }
   }
   
+  forEachFileIn("error", true) { output => () }
+
   forEachFileIn("valid") { output =>
     val Output(report, reporter) = output
     assert(report.totalConditions === report.totalValid,
-- 
GitLab