Skip to content

Commit

Permalink
- Add tests to ensure lazy vals in test blocks now work in Scala 2.…
Browse files Browse the repository at this point in the history
…12.x
  • Loading branch information
lihaoyi committed Sep 11, 2017
1 parent 36c2c3d commit c1799d2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,11 @@ Changelog
- Using uTest with `fork in Test := true` in SBT no longer gives an incorrect
results summmary

- Fix problem with lazy vals in test blocks crashing the compiler
[#67](https://github.com/lihaoyi/utest/issues/67). Note that the issue is only
fixed on 2.12.3, and not on Scala 2.10.x or 2.11.x.


0.4.8
-----

Expand Down
26 changes: 26 additions & 0 deletions utest/shared/src/test/scala-2.12/test/utest/LazyValTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package test.utest

import utest._

object What {
def imported = 2
}

object LazyValTest extends TestSuite {
override def tests = TestSuite {
import What._
lazy val subj = imported
'test{
lazy val y = "hello"
'inner{
lazy val z = "world"
val res = y * imported + z
assert(res == "hellohelloworld")
res
}
'inner2{
lazy val terminalLazyVal = y
}
}
}
}

0 comments on commit c1799d2

Please sign in to comment.