summaryrefslogtreecommitdiff
path: root/test/files/run/static-annot
diff options
context:
space:
mode:
authorAleksandar <aleksandar@htpc.(none)>2012-07-19 14:33:07 +0200
committerAleksandar <aleksandar@htpc.(none)>2012-07-19 14:33:32 +0200
commit227239018b38ab7218ee6b30493c9c8e1836c8c9 (patch)
tree1ca54e040ce5cde7930bb51c553cc218c3fb05e8 /test/files/run/static-annot
parent892ee3df93a10ffe24fb11b37ad7c3a9cb93d5de (diff)
downloadscala-227239018b38ab7218ee6b30493c9c8e1836c8c9.tar.gz
scala-227239018b38ab7218ee6b30493c9c8e1836c8c9.tar.bz2
scala-227239018b38ab7218ee6b30493c9c8e1836c8c9.zip
WIP add private/lazy checks and a few tests.
Diffstat (limited to 'test/files/run/static-annot')
-rw-r--r--test/files/run/static-annot/field.scala38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/files/run/static-annot/field.scala b/test/files/run/static-annot/field.scala
index 0677082cf6..a7d8158321 100644
--- a/test/files/run/static-annot/field.scala
+++ b/test/files/run/static-annot/field.scala
@@ -182,6 +182,43 @@ object Test7 extends Check {
+/* TEST 8 */
+
+object Foo8 {
+ @static val field = 7
+
+ val function: () => Int = () => {
+ field + 1
+ }
+
+ val anon = new Runnable {
+ def run() {
+ assert(field == 7, "runnable asserting field is 7")
+ }
+ }
+
+ @static var mutable = 10
+
+ val mutation: () => Unit = () => {
+ mutable += 1
+ }
+}
+
+object Test8 {
+ def test() {
+ assert(Foo8.function() == 8, "function must return 8")
+ Foo8.anon.run()
+ assert(Foo8.mutable == 10, "mutable is 10")
+ Foo8.mutation()
+ assert(Foo8.mutable == 11, "mutable is 11")
+ Foo8.mutation()
+ assert(Foo8.mutable == 12, "mutable is 12")
+ }
+}
+
+
+
+
/* main */
object Test {
@@ -194,6 +231,7 @@ object Test {
Test5.test()
Test6.test()
Test7.test()
+ Test8.test()
}
}