aboutsummaryrefslogblamecommitdiff
path: root/libraries/eval/test/EvalTest.scala
blob: bdb3d65c0d2d9b95e2fe56b0ff9fe53e0d53d15b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                            




                                                                                                                               

   
package com.twitter.util

import org.specs.Specification
import java.io.File

object EvaluatorSpec extends Specification {
  "Evaluator" should {
    "apply('expression')" in {
      Eval[Int]("1 + 1") mustEqual 2
    }

    "apply(new File(...))" in {
      Eval[Int](new File("src/test/resources/OnePlusOne.scala")) mustEqual 2
    }

    "apply(new File(...), new File(...))" in {
      val derived = Eval[() => String](new File("src/test/resources/Base.scala"), new File("src/test/resources/Derived.scala"))
      derived() mustEqual "hello"
    }
  }
}