alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (InteractiveTest.scala)

This example Scala source code file (InteractiveTest.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

compilercontrol, compilercontrol, global, global, int, int, interactivetest, position, seq, settings, storereporter, string, string, unit

The Scala InteractiveTest.scala source code

package scala.tools.nsc.interactive
package tests

import scala.tools.nsc.Settings
import scala.tools.nsc.reporters.StoreReporter
import scala.tools.nsc.util.{BatchSourceFile, SourceFile, Position}
import scala.tools.nsc.io._

/** A base class for writing interactive compiler tests.
 * 
 * @author Iulian Dragos
 *
 */
abstract class InteractiveTest {
  
  val settings = new Settings
  val reporter= new StoreReporter
  
  settings.YpresentationDebug.value = true
  lazy val compiler: CompilerControl = new Global(settings, reporter)

  def sources(filename: String*): Seq[SourceFile] = 
    filename map source

  def source(filename: String) = new BatchSourceFile(AbstractFile.getFile(filename)) 
  
  def pos(filename: String, line: Int, col: Int): Position = 
    source(filename).position(line, col)
    
  def runTest: Unit
  
  def main(args: Array[String]) {
    runTest
  }
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala InteractiveTest.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.