ScalaTest 2.0.RC1 released

86 views
Skip to first unread message

Bill Venners

unread,
Sep 30, 2013, 11:12:53 PM9/30/13
to scalate...@googlegroups.com, scala-a...@googlegroups.com
Hi All,

If you have time, please try out this release candidate of ScalaTest 2.0 and let us know if you find any issues by posting to scalatest-users.

Access the release:

http://scalatest.org/download#20rc1

View the release notes:

http://scalatest.org/release_notes/2.0

You may also be interested in this recent talk on the use of implicit parameters in ScalaTest 2.0:

Yann Simon

unread,
Oct 4, 2013, 3:51:05 AM10/4/13
to scalate...@googlegroups.com, scala-a...@googlegroups.com
Hi,

I tried this version, and some assert cannot compile.
They are all asserts that have a "clue" parameter, like that:
assert(a === 1, "a should be 1")

If I remove the clue ("a should be 1"), it compiles fine.

Should I use a new API for that?
Cheers,
Yann

Bill Venners

unread,
Oct 4, 2013, 11:02:00 AM10/4/13
to scalate...@googlegroups.com
Hi Yann,

Can you perhaps show the full class that exhibits this problem? It is supposed to still compile and work as before, and here's an interpreter session in which it does:

Mi-Novia:Downloads bv$ scala -cp scalatest_2.10-2.0.RC1.jar
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_43).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import org.scalatest._
import org.scalatest._

scala> import Assertions._
import Assertions._

scala> val a = 12
a: Int = 12

scala> assert(a === 1, "a should be 1")
org.scalatest.exceptions.TestFailedException: a should be 1
12 did not equal 1
    at org.scalatest.Assertions$class.newAssertionFailedException(Assertions.scala:402)
    at org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1253)
    at org.scalatest.Assertions$AssertionsHelper.macroAssertTrue(Assertions.scala:370)

Thanks.

Bill



--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

Yann Simon

unread,
Oct 8, 2013, 2:55:11 AM10/8/13
to scalate...@googlegroups.com
Hi Bill,

Thanks for the info, I tried your code with in the REPL, and it does work

My project is a play application, using scala 2.9 for sbt 0.12.4, and compiling with scala 2.10.
It can maybe explain the error.

In that case, I will wait to having migrated to sbt 0.13

I cannot show you the test class, but I manage to reproduce the error with a very simple test:
import org.scalatest.FunSuite

class SimpleTest extends FunSuite {

  test("simple test") {
    assert(2 === 2, "2 should be equal to 2")
  }

}

Error:
[info] Compiling 1 Scala source to /home/simon/ePost/project/apps/safe/safeservice-ui/target/scala-2.10/test-classes...
[info] ======= Position error
[info] Synthetic tree [534] contains nonsynthetic tree [522]
[info] == Enclosing tree [534] of type Apply at [118]SimpleTest.scala
[info] 
[info] [L   8        ] #534    [118]           Apply      // Apply(method apply)
[info] 
[info] == Enclosed tree [522] of type Literal at [128:152]SimpleTest.scala
[info] 
[info] [L   8        ] #522    [128:152]       Literal    // "2 should be equal to 2")
[info] 
[info] 
[info] While validating #540
[info] [L   1        ] #540    [0:160]         PackageDef // models
[info] 
[info] Children:
[info]   [L   1 P#  540] #43     [8:14]          Ident      // models
[info]   [L   3 P#  540] #46     [16:45]         Import     // org.scalatest.FunSuite
[info]   [L   5 P#  540] #539    [47:160]        ClassDef   // SimpleTest extends FunSuite {
[info] =======
[error] 
[error]      while compiling: /home/simon/ePost/project/apps/safe/safeservice-ui/test/models/SimpleTest.scala
[error]         during phase: typer
[error]      library version: version 2.10.3
[error]     compiler version: version 2.10.3
[error]   reconstructed args: -encoding utf8 -bootclasspath /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/sunrsasign.jar:[...]:/home/simon/.ivy2/cache/org.scalatest/scalatest_2.10/jars/scalatest_2.10-2.0.RC1.jar -unchecked -Xmax-classfile-name 128
[error] 
[error]   last tree to typer: Block
[error]               symbol: null
[error]    symbol definition: null
[error]                  tpe: Unit
[error]        symbol owners: 
[error]       context owners: value <local SimpleTest> -> class SimpleTest -> package models
[error] 
[error] == Enclosing template or block ==
[error] 
[error] Template( // val <local SimpleTest>: <notype> in class SimpleTest
[error]   "FunSuite" // parents
[error]   ValDef(
[error]     private
[error]     "_"
[error]     <tpt>
[error]     <empty>
[error]   )
[error]   // 2 statements
[error]   DefDef( // def <init>(): models.SimpleTest in class SimpleTest
[error]     <method>
[error]     "<init>"
[error]     []
[error]     List(Nil)
[error]     <tpt> // tree.tpe=models.SimpleTest
[error]     Block( // tree.tpe=Unit
[error]       Apply( // def <init>(): org.scalatest.FunSuite in class FunSuite, tree.tpe=org.scalatest.FunSuite
[error]         SimpleTest.super."<init>" // def <init>(): org.scalatest.FunSuite in class FunSuite, tree.tpe=()org.scalatest.FunSuite
[error]         Nil
[error]       )
[error]       ()
[error]     )
[error]   )
[error]   Apply(
[error]     Apply(
[error]       "test"
[error]       "simple test"
[error]     )
[error]     Apply(
[error]       "assert"
[error]       // 2 arguments
[error]       Apply(
[error]         2."$eq$eq$eq"
[error]         2
[error]       )
[error]       "2 should be equal to 2"
[error]     )
[error]   )
[error] )
[error] 
[error] == Expanded type of tree ==
[error] 
[error] TypeRef(TypeSymbol(final abstract class Unit extends AnyVal))
[error] 
[error] uncaught exception during compilation: scala.tools.nsc.interactive.RangePositions$ValidateException
[error] (test:compile) scala.tools.nsc.interactive.RangePositions$ValidateException: Synthetic tree [534] contains nonsynthetic tree [522]
[error] Total time: 1 s, completed 08.10.2013 08:48:56

Cheers,
Yann

2013/10/4 Bill Venners <bi...@artima.com>

Yann Simon

unread,
Dec 4, 2013, 9:56:05 AM12/4/13
to scalate...@googlegroups.com
If any interest, I found out the problem.

I add the following options in my build:

scalacOptions in Test ++= Seq("-Yrangepos")

Removing that line resolved the problem, and I can use ScalaTest 2.0 now.

Cheers,
Yann


2013/10/8 Yann Simon <yann.s...@gmail.com>
Reply all
Reply to author
Forward
0 new messages