You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2009/11/08 06:54:51 UTC

svn commit: r833834 - in /buildr/trunk: lib/buildr/scala/tests.rb spec/scala/tests_spec.rb

Author: boisvert
Date: Sun Nov  8 05:54:50 2009
New Revision: 833834

URL: http://svn.apache.org/viewvc?rev=833834&view=rev
Log:
Fix Scalatest specs (1.0 API compatibility); revert to Scalacheck 1.5 since 1.6 is incompatible with Scalatest 1.0

Modified:
    buildr/trunk/lib/buildr/scala/tests.rb
    buildr/trunk/spec/scala/tests_spec.rb

Modified: buildr/trunk/lib/buildr/scala/tests.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/tests.rb?rev=833834&r1=833833&r2=833834&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/scala/tests.rb (original)
+++ buildr/trunk/lib/buildr/scala/tests.rb Sun Nov  8 05:54:50 2009
@@ -23,7 +23,7 @@
 module Buildr::Scala
   # Scala::Check is available when using Scala::Test or Scala::Specs
   module Check
-    VERSION = '1.6'
+    VERSION = '1.5'
     
     class << self
       def version
@@ -112,7 +112,7 @@
             # TODO: This should be name=>value pairs!
             #ant.includes group_includes.join(" ") if group_includes
             #ant.excludes group_excludes.join(" ") if group_excludes
-            (options[:properties] || []).each { |name, value| ant.property :name=>name, :value=>value }
+            (options[:properties] || []).each { |name, value| ant.config :name=>name, :value=>value }
           end
         end
         
@@ -127,7 +127,7 @@
           File.open(reportFile, "r") do |input|
             while (line = input.gets) do
               failed = (line =~ /(TESTS? FAILED -)|(RUN STOPPED)|(RUN ABORTED)/) unless failed
-              completed |= (line =~ /Run completed\./)
+              completed |= (line =~ /Run completed/)
               break if (failed)
             end
           end

Modified: buildr/trunk/spec/scala/tests_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/scala/tests_spec.rb?rev=833834&r1=833833&r2=833834&view=diff
==============================================================================
--- buildr/trunk/spec/scala/tests_spec.rb (original)
+++ buildr/trunk/spec/scala/tests_spec.rb Sun Nov  8 05:54:50 2009
@@ -113,7 +113,7 @@
           val sum = 1 + 1
           assert(sum === 2)
         }
-        
+
         class InnerSuite extends FunSuite {
           test("addition") {
             val sum = 1 + 1
@@ -180,15 +180,16 @@
     write 'src/test/scala/PropertyTestSuite.scala', <<-SCALA
       import org.scalatest._
       class PropertyTestSuite extends FunSuite {
-        var properties = Map[String, Any]()
+        var configMap = Map[String, Any]()
         test("testProperty") {
-          assert(properties("name") === "value")
+          assert(configMap("name") === "value")
         }
-        
+
         protected override def runTests(testName: Option[String], reporter: Reporter, stopper: Stopper,
-                                        includes: Set[String], excludes: Set[String], properties: Map[String, Any]) {
-          this.properties = properties;                              
-          super.runTests(testName, reporter, stopper, includes, excludes, properties)
+                                        filter: Filter, configMap: Map[String, Any],
+                                        distributor: Option[Distributor], tracker: Tracker) {
+          this.configMap = configMap
+          super.runTests(testName, reporter, stopper, filter, configMap, distributor, tracker)
         }
       }
     SCALA
@@ -198,54 +199,55 @@
 
   it 'should run with ScalaCheck automatic test case generation' do
     write 'src/test/scala/MySuite.scala', <<-SCALA
-      import org.scalatest.prop.PropSuite
+      import org.scalatest.FunSuite
+      import org.scalatest.prop.Checkers
       import org.scalacheck.Arbitrary._
       import org.scalacheck.Prop._
-      
-      class MySuite extends PropSuite {
-      
+
+      class MySuite extends FunSuite with Checkers {
+
         test("list concatenation") {
           val x = List(1, 2, 3)
           val y = List(4, 5, 6)
           assert(x ::: y === List(1, 2, 3, 4, 5, 6))
           check((a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size)
         }
-      
-        test(
-          "list concatenation using a test method",
-          (a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size
-        )
+
+        test("list concatenation using a test method") {
+          check((a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size)
+        }
       }
     SCALA
     define('foo')
     project('foo').test.invoke
     project('foo').test.passed_tests.should include('MySuite')
   end
-  
+
   it 'should fail if ScalaCheck test case fails' do
     write 'src/test/scala/StringSuite.scala', <<-SCALA
-      import org.scalatest.prop.PropSuite
+      import org.scalatest.FunSuite
+      import org.scalatest.prop.Checkers
       import org.scalacheck.Arbitrary._
       import org.scalacheck.Prop._
 
-      class StringSuite extends PropSuite {
+      class StringSuite extends FunSuite with Checkers {
         test("startsWith") {
           check( (a: String, b: String) => (a+b).startsWith(a) )
         }
-      
+
         test("endsWith") {
           check( (a: String, b: String) => (a+b).endsWith(b) )
         }
-      
+
         // Is this really always true?
         test("concat") {
           check( (a: String, b: String) => (a+b).length > a.length && (a+b).length > b.length )
         }
-      
+
         test("substring2") {
           check( (a: String, b: String) => (a+b).substring(a.length) == b )
         }
-      
+
         test("substring3") {
           check( (a: String, b: String, c: String) =>
                    (a+b+c).substring(a.length, a.length+b.length) == b )



Re: svn commit: r833834 - in /buildr/trunk: lib/buildr/scala/tests.rb spec/scala/tests_spec.rb

Posted by Alex Boisvert <al...@gmail.com>.
According to Bill Venners, ScalaTest will be updated soon.
(I was going to report the issue earlier today but somebody else beat me to
it)

Until we find a combination that works for all frameworks, my vote would be
to revert to Specs 1.6.

And one request:  please run the specs when upgrading versions.  The specs
were all broken before I picked them up today.  It's worrying to work on
different area (unrelated code) without knowing if I inadvertently broke
other things.

thanks,
alex

On Sat, Nov 7, 2009 at 10:05 PM, Daniel Spiewak <dj...@gmail.com> wrote:

> We need to make a decision here.  ScalaCheck 1.5 is incompatible with Specs
> 1.6.1.  We could stick with Specs 1.6, but there are a lot of very useful
> fixes and improvements in 1.6.1, including several which I require for my
> projects.
>
> I guess ideally ScalaTest would update to support ScalaCheck 1.6, but I
> don't know when that is going to happen.
>
> Daniel
>
> On Nov 7, 2009, at 11:55 PM, "boisvert@apache.org" <bo...@apache.org>
> wrote:
>
>  Author: boisvert
>> Date: Sun Nov  8 05:54:50 2009
>> New Revision: 833834
>>
>> URL: http://svn.apache.org/viewvc?rev=833834&view=rev
>> Log:
>> Fix Scalatest specs (1.0 API compatibility); revert to Scalacheck 1.5
>> since 1.6 is incompatible with Scalatest 1.0
>>
>> Modified:
>>   buildr/trunk/lib/buildr/scala/tests.rb
>>   buildr/trunk/spec/scala/tests_spec.rb
>>
>> Modified: buildr/trunk/lib/buildr/scala/tests.rb
>> URL:
>> http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/tests.rb?rev=833834&r1=833833&r2=833834&view=diff
>>
>> ==============================================================================
>> --- buildr/trunk/lib/buildr/scala/tests.rb (original)
>> +++ buildr/trunk/lib/buildr/scala/tests.rb Sun Nov  8 05:54:50 2009
>> @@ -23,7 +23,7 @@
>> module Buildr::Scala
>>  # Scala::Check is available when using Scala::Test or Scala::Specs
>>  module Check
>> -    VERSION = '1.6'
>> +    VERSION = '1.5'
>>
>>    class << self
>>      def version
>> @@ -112,7 +112,7 @@
>>            # TODO: This should be name=>value pairs!
>>            #ant.includes group_includes.join(" ") if group_includes
>>            #ant.excludes group_excludes.join(" ") if group_excludes
>> -            (options[:properties] || []).each { |name, value|
>> ant.property :name=>name, :value=>value }
>> +            (options[:properties] || []).each { |name, value| ant.config
>> :name=>name, :value=>value }
>>          end
>>        end
>>
>> @@ -127,7 +127,7 @@
>>          File.open(reportFile, "r") do |input|
>>            while (line = input.gets) do
>>              failed = (line =~ /(TESTS? FAILED -)|(RUN STOPPED)|(RUN
>> ABORTED)/) unless failed
>> -              completed |= (line =~ /Run completed\./)
>> +              completed |= (line =~ /Run completed/)
>>              break if (failed)
>>            end
>>          end
>>
>> Modified: buildr/trunk/spec/scala/tests_spec.rb
>> URL:
>> http://svn.apache.org/viewvc/buildr/trunk/spec/scala/tests_spec.rb?rev=833834&r1=833833&r2=833834&view=diff
>>
>> ==============================================================================
>> --- buildr/trunk/spec/scala/tests_spec.rb (original)
>> +++ buildr/trunk/spec/scala/tests_spec.rb Sun Nov  8 05:54:50 2009
>> @@ -113,7 +113,7 @@
>>          val sum = 1 + 1
>>          assert(sum === 2)
>>        }
>> -
>> +
>>        class InnerSuite extends FunSuite {
>>          test("addition") {
>>            val sum = 1 + 1
>> @@ -180,15 +180,16 @@
>>    write 'src/test/scala/PropertyTestSuite.scala', <<-SCALA
>>      import org.scalatest._
>>      class PropertyTestSuite extends FunSuite {
>> -        var properties = Map[String, Any]()
>> +        var configMap = Map[String, Any]()
>>        test("testProperty") {
>> -          assert(properties("name") === "value")
>> +          assert(configMap("name") === "value")
>>        }
>> -
>> +
>>        protected override def runTests(testName: Option[String], reporter:
>> Reporter, stopper: Stopper,
>> -                                        includes: Set[String], excludes:
>> Set[String], properties: Map[String, Any]) {
>> -          this.properties = properties;
>> -          super.runTests(testName, reporter, stopper, includes, excludes,
>> properties)
>> +                                        filter: Filter, configMap:
>> Map[String, Any],
>> +                                        distributor: Option[Distributor],
>> tracker: Tracker) {
>> +          this.configMap = configMap
>> +          super.runTests(testName, reporter, stopper, filter, configMap,
>> distributor, tracker)
>>        }
>>      }
>>    SCALA
>> @@ -198,54 +199,55 @@
>>
>>  it 'should run with ScalaCheck automatic test case generation' do
>>    write 'src/test/scala/MySuite.scala', <<-SCALA
>> -      import org.scalatest.prop.PropSuite
>> +      import org.scalatest.FunSuite
>> +      import org.scalatest.prop.Checkers
>>      import org.scalacheck.Arbitrary._
>>      import org.scalacheck.Prop._
>> -
>> -      class MySuite extends PropSuite {
>> -
>> +
>> +      class MySuite extends FunSuite with Checkers {
>> +
>>        test("list concatenation") {
>>          val x = List(1, 2, 3)
>>          val y = List(4, 5, 6)
>>          assert(x ::: y === List(1, 2, 3, 4, 5, 6))
>>          check((a: List[Int], b: List[Int]) => a.size + b.size == (a :::
>> b).size)
>>        }
>> -
>> -        test(
>> -          "list concatenation using a test method",
>> -          (a: List[Int], b: List[Int]) => a.size + b.size == (a :::
>> b).size
>> -        )
>> +
>> +        test("list concatenation using a test method") {
>> +          check((a: List[Int], b: List[Int]) => a.size + b.size == (a :::
>> b).size)
>> +        }
>>      }
>>    SCALA
>>    define('foo')
>>    project('foo').test.invoke
>>    project('foo').test.passed_tests.should include('MySuite')
>>  end
>> -
>> +
>>  it 'should fail if ScalaCheck test case fails' do
>>    write 'src/test/scala/StringSuite.scala', <<-SCALA
>> -      import org.scalatest.prop.PropSuite
>> +      import org.scalatest.FunSuite
>> +      import org.scalatest.prop.Checkers
>>      import org.scalacheck.Arbitrary._
>>      import org.scalacheck.Prop._
>>
>> -      class StringSuite extends PropSuite {
>> +      class StringSuite extends FunSuite with Checkers {
>>        test("startsWith") {
>>          check( (a: String, b: String) => (a+b).startsWith(a) )
>>        }
>> -
>> +
>>        test("endsWith") {
>>          check( (a: String, b: String) => (a+b).endsWith(b) )
>>        }
>> -
>> +
>>        // Is this really always true?
>>        test("concat") {
>>          check( (a: String, b: String) => (a+b).length > a.length &&
>> (a+b).length > b.length )
>>        }
>> -
>> +
>>        test("substring2") {
>>          check( (a: String, b: String) => (a+b).substring(a.length) == b )
>>        }
>> -
>> +
>>        test("substring3") {
>>          check( (a: String, b: String, c: String) =>
>>                   (a+b+c).substring(a.length, a.length+b.length) == b )
>>
>>
>>

Re: svn commit: r833834 - in /buildr/trunk: lib/buildr/scala/tests.rb spec/scala/tests_spec.rb

Posted by Daniel Spiewak <dj...@gmail.com>.
We need to make a decision here.  ScalaCheck 1.5 is incompatible with  
Specs 1.6.1.  We could stick with Specs 1.6, but there are a lot of  
very useful fixes and improvements in 1.6.1, including several which I  
require for my projects.

I guess ideally ScalaTest would update to support ScalaCheck 1.6, but  
I don't know when that is going to happen.

Daniel

On Nov 7, 2009, at 11:55 PM, "boisvert@apache.org"  
<bo...@apache.org> wrote:

> Author: boisvert
> Date: Sun Nov  8 05:54:50 2009
> New Revision: 833834
>
> URL: http://svn.apache.org/viewvc?rev=833834&view=rev
> Log:
> Fix Scalatest specs (1.0 API compatibility); revert to Scalacheck  
> 1.5 since 1.6 is incompatible with Scalatest 1.0
>
> Modified:
>    buildr/trunk/lib/buildr/scala/tests.rb
>    buildr/trunk/spec/scala/tests_spec.rb
>
> Modified: buildr/trunk/lib/buildr/scala/tests.rb
> URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/tests.rb?rev=833834&r1=833833&r2=833834&view=diff
> === 
> === 
> === 
> =====================================================================
> --- buildr/trunk/lib/buildr/scala/tests.rb (original)
> +++ buildr/trunk/lib/buildr/scala/tests.rb Sun Nov  8 05:54:50 2009
> @@ -23,7 +23,7 @@
> module Buildr::Scala
>   # Scala::Check is available when using Scala::Test or Scala::Specs
>   module Check
> -    VERSION = '1.6'
> +    VERSION = '1.5'
>
>     class << self
>       def version
> @@ -112,7 +112,7 @@
>             # TODO: This should be name=>value pairs!
>             #ant.includes group_includes.join(" ") if group_includes
>             #ant.excludes group_excludes.join(" ") if group_excludes
> -            (options[:properties] || []).each { |name, value|  
> ant.property :name=>name, :value=>value }
> +            (options[:properties] || []).each { |name, value|  
> ant.config :name=>name, :value=>value }
>           end
>         end
>
> @@ -127,7 +127,7 @@
>           File.open(reportFile, "r") do |input|
>             while (line = input.gets) do
>               failed = (line =~ /(TESTS? FAILED -)|(RUN STOPPED)| 
> (RUN ABORTED)/) unless failed
> -              completed |= (line =~ /Run completed\./)
> +              completed |= (line =~ /Run completed/)
>               break if (failed)
>             end
>           end
>
> Modified: buildr/trunk/spec/scala/tests_spec.rb
> URL: http://svn.apache.org/viewvc/buildr/trunk/spec/scala/tests_spec.rb?rev=833834&r1=833833&r2=833834&view=diff
> === 
> === 
> === 
> =====================================================================
> --- buildr/trunk/spec/scala/tests_spec.rb (original)
> +++ buildr/trunk/spec/scala/tests_spec.rb Sun Nov  8 05:54:50 2009
> @@ -113,7 +113,7 @@
>           val sum = 1 + 1
>           assert(sum === 2)
>         }
> -
> +
>         class InnerSuite extends FunSuite {
>           test("addition") {
>             val sum = 1 + 1
> @@ -180,15 +180,16 @@
>     write 'src/test/scala/PropertyTestSuite.scala', <<-SCALA
>       import org.scalatest._
>       class PropertyTestSuite extends FunSuite {
> -        var properties = Map[String, Any]()
> +        var configMap = Map[String, Any]()
>         test("testProperty") {
> -          assert(properties("name") === "value")
> +          assert(configMap("name") === "value")
>         }
> -
> +
>         protected override def runTests(testName: Option[String],  
> reporter: Reporter, stopper: Stopper,
> -                                        includes: Set[String],  
> excludes: Set[String], properties: Map[String, Any]) {
> -          this.properties = properties;
> -          super.runTests(testName, reporter, stopper, includes,  
> excludes, properties)
> +                                        filter: Filter, configMap:  
> Map[String, Any],
> +                                        distributor: Option 
> [Distributor], tracker: Tracker) {
> +          this.configMap = configMap
> +          super.runTests(testName, reporter, stopper, filter,  
> configMap, distributor, tracker)
>         }
>       }
>     SCALA
> @@ -198,54 +199,55 @@
>
>   it 'should run with ScalaCheck automatic test case generation' do
>     write 'src/test/scala/MySuite.scala', <<-SCALA
> -      import org.scalatest.prop.PropSuite
> +      import org.scalatest.FunSuite
> +      import org.scalatest.prop.Checkers
>       import org.scalacheck.Arbitrary._
>       import org.scalacheck.Prop._
> -
> -      class MySuite extends PropSuite {
> -
> +
> +      class MySuite extends FunSuite with Checkers {
> +
>         test("list concatenation") {
>           val x = List(1, 2, 3)
>           val y = List(4, 5, 6)
>           assert(x ::: y === List(1, 2, 3, 4, 5, 6))
>           check((a: List[Int], b: List[Int]) => a.size + b.size ==  
> (a ::: b).size)
>         }
> -
> -        test(
> -          "list concatenation using a test method",
> -          (a: List[Int], b: List[Int]) => a.size + b.size == (a :::  
> b).size
> -        )
> +
> +        test("list concatenation using a test method") {
> +          check((a: List[Int], b: List[Int]) => a.size + b.size ==  
> (a ::: b).size)
> +        }
>       }
>     SCALA
>     define('foo')
>     project('foo').test.invoke
>     project('foo').test.passed_tests.should include('MySuite')
>   end
> -
> +
>   it 'should fail if ScalaCheck test case fails' do
>     write 'src/test/scala/StringSuite.scala', <<-SCALA
> -      import org.scalatest.prop.PropSuite
> +      import org.scalatest.FunSuite
> +      import org.scalatest.prop.Checkers
>       import org.scalacheck.Arbitrary._
>       import org.scalacheck.Prop._
>
> -      class StringSuite extends PropSuite {
> +      class StringSuite extends FunSuite with Checkers {
>         test("startsWith") {
>           check( (a: String, b: String) => (a+b).startsWith(a) )
>         }
> -
> +
>         test("endsWith") {
>           check( (a: String, b: String) => (a+b).endsWith(b) )
>         }
> -
> +
>         // Is this really always true?
>         test("concat") {
>           check( (a: String, b: String) => (a+b).length > a.length  
> && (a+b).length > b.length )
>         }
> -
> +
>         test("substring2") {
>           check( (a: String, b: String) => (a+b).substring(a.length)  
> == b )
>         }
> -
> +
>         test("substring3") {
>           check( (a: String, b: String, c: String) =>
>                    (a+b+c).substring(a.length, a.length+b.length) ==  
> b )
>
>