aboutsummaryrefslogblamecommitdiff
path: root/compiler/test/dotty/tools/dotc/vulpix/VulpixTests.scala
blob: 1a177599536d96e29c66f95d0010babc4e5dd131 (plain) (tree)
1
2
3
4
5
6
7
8
9


             
              



                         
                                  

                                  
                                           

                           


                                                  

                                                
 

                               
                                                                                                                 







                                                        
                                                                                                         
 

                                                                                                                  

                                     
                                                                                                                    

                                    
                                                                                                                   

                                      
                                                                                                                      

                                  
                                                                                                      

                                   
                                                                                                        

                                   
                                                                                                        

                                  
                                                                                                       


                                                                                                      


                                                                                              
 
package dotty
package tools
package dotc
package vulpix

import org.junit.Assert._
import org.junit.Test

import scala.concurrent.duration._
import scala.util.control.NonFatal

class VulpixTests extends ParallelTesting {
  import CompilationTests._

  def maxDuration = 3.seconds
  def numberOfSlaves = 5
  def safeMode = sys.env.get("SAFEMODE").isDefined
  def isInteractive = !sys.env.contains("DRONE")
  def testFilter = None

  @Test def missingFile: Unit =
    try {
      compileFile("../tests/partest-test/i-dont-exist.scala", defaultOptions).expectFailure.checkExpectedErrors()
      fail("didn't fail properly")
    }
    catch {
      case _: IllegalArgumentException => // pass!
      case NonFatal(_) => fail("wrong exception thrown")
    }

  @Test def pos1Error: Unit =
    compileFile("../tests/partest-test/posFail1Error.scala", defaultOptions).expectFailure.checkCompile()

  @Test def negMissingAnnot: Unit =
    compileFile("../tests/partest-test/negMissingAnnot.scala", defaultOptions).expectFailure.checkExpectedErrors()

  @Test def negAnnotWrongLine: Unit =
    compileFile("../tests/partest-test/negAnnotWrongLine.scala", defaultOptions).expectFailure.checkExpectedErrors()

  @Test def negTooManyAnnots: Unit =
    compileFile("../tests/partest-test/negTooManyAnnots.scala", defaultOptions).expectFailure.checkExpectedErrors()

  @Test def negNoPositionAnnot: Unit =
    compileFile("../tests/partest-test/negNoPositionAnnots.scala", defaultOptions).expectFailure.checkExpectedErrors()

  @Test def runCompileFail: Unit =
    compileFile("../tests/partest-test/posFail1Error.scala", defaultOptions).expectFailure.checkRuns()

  @Test def runWrongOutput1: Unit =
    compileFile("../tests/partest-test/runWrongOutput1.scala", defaultOptions).expectFailure.checkRuns()

  @Test def runWrongOutput2: Unit =
    compileFile("../tests/partest-test/runWrongOutput2.scala", defaultOptions).expectFailure.checkRuns()

  @Test def runDiffOutput1: Unit =
    compileFile("../tests/partest-test/runDiffOutput1.scala", defaultOptions).expectFailure.checkRuns()

  @Test def runStackOverflow: Unit =
    compileFile("../tests/partest-test/stackOverflow.scala", defaultOptions).expectFailure.checkRuns()

  @Test def runOutRedirects: Unit =
    compileFile("../tests/partest-test/i2147.scala", defaultOptions).expectFailure.checkRuns()
}