summaryrefslogtreecommitdiff
path: root/test/disabled/run/code.scala
blob: 8881c2eda8aee60692126b49bd02b1d0f91e1023 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import scala.tools.partest.utils.CodeTest

case class Element(name: String)

object Test extends App {
  case class InnerElement(name: String)
  def foo[T](ys: List[T]) = {
    val fun: reflect.Code[Int => Int] = x => x + ys.length
    fun
  }
  CodeTest(foo(List(2)), args)
  CodeTest({() => val e = Element("someName"); e}, args)
//  CodeTest({() => val e = InnerElement("someName"); e}, args) // (does not work yet)
  def titi() = {
    var truc = 0
    CodeTest(() => {
      truc = 6
    }, args)
  }
  def tata(): Unit = {
    var truc = 0
    CodeTest(() => {
      truc = truc + 6
    }, args)
  }
  titi()
  tata()
  new baz.A(args)

  def show() {
    def foo[T](ys: List[T]) = {
      val fun: reflect.Code[Int => Int] = x => x + ys.length
      CodeTest(fun, args)
    }
    foo(List(1, 2, 3))
  }

  show()
}

package baz {

  case class BazElement(name: String) { }

  class A(args: Array[String]) {
    CodeTest(() => new baz.BazElement("someName"), args)
  }

}