Skip to content

Commit fc0ce6a

Browse files
authored
Merge pull request #28 from scala-exercises/enrique-2-12-10-update
Update to Scala 2.12.10
2 parents f6b8d8a + f3fbc28 commit fc0ce6a

17 files changed

+98
-127
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: scala
22
scala:
3-
- 2.11.11
3+
- 2.12.10
44
jdk:
5-
- oraclejdk8
5+
- openjdk8
66
script:
77
- sbt test
88

build.sbt

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
val scalaExercisesV = "0.4.0-SNAPSHOT"
1+
import ProjectPlugin.autoImport._
2+
3+
val scalaExercisesV = "0.5.0-SNAPSHOT"
24

35
def dep(artifactId: String) = "org.scala-exercises" %% artifactId % scalaExercisesV
46

57
lazy val scalacheck = (project in file("."))
68
.enablePlugins(ExerciseCompilerPlugin)
79
.settings(
8-
name := "exercises-scalacheck",
10+
name := "exercises-scalacheck",
911
libraryDependencies ++= Seq(
1012
dep("exercise-compiler"),
1113
dep("definitions"),
12-
%%("scalatest"),
13-
%%("scalacheck"),
14-
%%("scheckShapeless"),
15-
"com.fortysevendeg" %% "scalacheck-datetime" % "0.2.0"
14+
%%("scalatest", V.scalatest),
15+
%%("scalacheck", V.scalacheck),
16+
%%("shapeless", V.shapeless),
17+
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless,
18+
"com.47deg" %% "scalacheck-toolbox-datetime" % V.scalacheckDatetime
1619
)
1720
)
1821

project/ProjectPlugin.scala

+20-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import de.heikoseeberger.sbtheader.HeaderPattern
21
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
2+
import de.heikoseeberger.sbtheader.License._
33
import sbt.Keys._
44
import sbt._
55
import sbtorgpolicies._
@@ -12,6 +12,20 @@ object ProjectPlugin extends AutoPlugin {
1212

1313
override def requires: Plugins = plugins.JvmPlugin && OrgPoliciesPlugin
1414

15+
object autoImport {
16+
17+
lazy val V = new {
18+
val scala212: String = "2.12.10"
19+
val shapeless: String = "2.3.3"
20+
val scalatest: String = "3.0.8"
21+
val scalacheck: String = "1.14.2"
22+
val scalacheckShapeless: String = "1.2.3"
23+
val scalacheckDatetime: String = "0.3.1"
24+
}
25+
}
26+
27+
import autoImport._
28+
1529
override def projectSettings: Seq[Def.Setting[_]] =
1630
Seq(
1731
description := "Scala Exercises: The path to enlightenment",
@@ -25,23 +39,17 @@ object ProjectPlugin extends AutoPlugin {
2539
organizationEmail = "[email protected]"
2640
),
2741
orgLicenseSetting := ApacheLicense,
28-
scalaVersion := "2.11.11",
42+
scalaVersion := V.scala212,
2943
scalaOrganization := "org.scala-lang",
30-
crossScalaVersions := Seq("2.11.11"),
3144
resolvers ++= Seq(
3245
Resolver.mavenLocal,
3346
Resolver.sonatypeRepo("snapshots"),
3447
Resolver.sonatypeRepo("releases")
3548
),
3649
scalacOptions := sbtorgpolicies.model.scalacCommonOptions,
37-
headers := Map(
38-
"scala" -> (HeaderPattern.cStyleBlockComment,
39-
s"""|/*
40-
| * scala-exercises - ${name.value}
41-
| * Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
42-
| */
43-
|
44-
|""".stripMargin)
45-
)
50+
headerLicense := Some(Custom(s"""| scala-exercises - ${name.value}
51+
| Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
52+
|
53+
|""".stripMargin))
4654
)
4755
}

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.13
1+
sbt.version=1.2.8

project/plugins.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ resolvers ++= Seq(
22
Resolver.sonatypeRepo("snapshots")
33
)
44

5-
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.4.0-SNAPSHOT", "0.13", "2.10")
6-
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.5.13")
5+
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.5.0-SNAPSHOT")
6+
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.12.0-M3")

src/main/scala/scalachecklib/ArbitrarySection.scala

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
78

89
import org.scalatest.Matchers
9-
import org.scalatest.prop.Checkers
10+
import org.scalatestplus.scalacheck.Checkers
1011

1112
/** ==The `arbitrary` Generator==
1213
*
@@ -33,10 +34,7 @@ import org.scalatest.prop.Checkers
3334
*
3435
* @param name arbitrary
3536
*/
36-
object ArbitrarySection
37-
extends Checkers
38-
with Matchers
39-
with org.scalaexercises.definitions.Section {
37+
object ArbitrarySection extends Checkers with Matchers with org.scalaexercises.definitions.Section {
4038

4139
import GeneratorsHelper._
4240

src/main/scala/scalachecklib/GeneratorsHelper.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib

src/main/scala/scalachecklib/GeneratorsSection.scala

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
78

89
import org.scalatest.Matchers
9-
import org.scalatest.prop.Checkers
10+
import org.scalatestplus.scalacheck.Checkers
1011

1112
/** Generators are responsible for generating test data in ScalaCheck, and are represented by the `org.scalacheck.Gen`
12-
* class. In the `Gen` object, there are several methods for creating new and modifying existing generators.
13+
* class. ou need to know how to use this class if you want ScalaCheck to generate data of types that are not supported
14+
* by default, or if you want to use the `forAll` method mentioned above, to state properties about a specific subset of
15+
* a type. In the `Gen` object, there are several methods for creating new and modifying existing generators.
1316
* We will show how to use some of them in this section. For a more complete reference of what is available,
14-
* please see the [[https://www.scalacheck.org/files/scalacheck_2.11-1.13.4-api/index.html API scaladoc]].
17+
* please see the API scaladoc.
1518
*
1619
*
1720
* A generator can be seen simply as a function that takes some generation parameters, and (maybe) returns a
@@ -214,13 +217,15 @@ object GeneratorsSection
214217
* {{{
215218
* val genIntList = Gen.containerOf[List,Int](Gen.oneOf(1, 3, 5))
216219
*
217-
* val genStringStream = Gen.containerOf[Stream,String](Gen.alphaStr)
220+
* val genStringStream = Gen.containerOf[LazyList,String](Gen.alphaStr)
218221
*
219222
* val genBoolArray = Gen.containerOf[Array,Boolean](true)
220223
* }}}
221224
*
222-
* By default, ScalaCheck supports generation of `List`, `Stream`, `Set`, `Array`, and `ArrayList`
223-
* (from `java.util`). You can add support for additional containers by adding implicit `Buildable` instances.
225+
* By default, ScalaCheck supports generation of `List`, `Stream` (Scala 2.10 -
226+
* 2.12, deprecated in 2.13), `LazyList` (Scala 2.13), `Set`, `Array`, and
227+
* `ArrayList` (from `java.util`). You can add support for additional containers
228+
* by adding implicit `Buildable` instances. See `Buildable.scala` for examples.
224229
*
225230
* There is also `Gen.nonEmptyContainerOf` for generating non-empty containers, and `Gen.containerOfN` for
226231
* generating containers of a given size.

src/main/scala/scalachecklib/PropertiesSection.scala

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
78

89
import org.scalatest._
9-
import org.scalatest.prop.Checkers
10+
import org.scalatestplus.scalacheck.Checkers
1011

1112
/** A ''property'' is the testable unit in ScalaCheck, and is represented by the `org.scalacheck.Prop` class.
1213
* There are several ways to create properties in ScalaCheck, one of them is to use the `org.scalacheck.Prop.forAll`
@@ -119,7 +120,7 @@ object PropertiesSection
119120
* all cases where `n` is non-zero will be thrown away:
120121
*
121122
* {{{
122-
* scala> import org.scalacheck.Prop.{forAll, BooleanOperators}
123+
* scala> import org.scalacheck.Prop.{forAll, propBoolean}
123124
* scala> val propTrivial = forAll { n: Int =>
124125
* | (n == 0) ==> n + 10 == 10
125126
* | }
@@ -138,7 +139,7 @@ object PropertiesSection
138139
*/
139140
def conditionalProperties(res0: Int) = {
140141

141-
import org.scalacheck.Prop.{forAll, BooleanOperators}
142+
import org.scalacheck.Prop.{forAll, propBoolean}
142143

143144
check {
144145
forAll { n: Int =>
@@ -201,7 +202,7 @@ object PropertiesSection
201202

202203
class ZeroSpecification extends Properties("Zero") {
203204

204-
import org.scalacheck.Prop.{forAll, BooleanOperators}
205+
import org.scalacheck.Prop.{forAll, propBoolean}
205206

206207
property("addition property") = forAll { n: Int =>
207208
(n != 0) ==> (n + res0 == n)

src/main/scala/scalachecklib/ScalacheckDatetimeSection.scala

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
78

89
import org.scalatest.Matchers
9-
import org.scalatest.prop.Checkers
10+
import org.scalatestplus.scalacheck.Checkers
1011

1112
/** scalacheck-datetime is a library for helping use datetime libraries with ScalaCheck
1213
*
@@ -18,12 +19,12 @@ import org.scalatest.prop.Checkers
1819
* {{{
1920
* resolvers += Resolver.sonatypeRepo("releases")
2021
*
21-
* "com.fortysevendeg" %% "scalacheck-datetime" % "0.2.0" % "test"
22+
* "com.47deg" %% "scalacheck-toolbox-datetime" % "0.3.1" % "test"
2223
* }}}
2324
*
24-
* Please, visit the [[https://47deg.github.io/scalacheck-datetime homepage]] for more information
25+
* Please, visit the [[https://47deg.github.io/scalacheck-toolbox homepage]] for more information
2526
*
26-
* @param name scalacheck-datetime
27+
* @param name scalacheck-toolbox-datetime
2728
*/
2829
object ScalacheckDatetimeSection
2930
extends Checkers

src/main/scala/scalachecklib/ScalacheckLibrary.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
@@ -18,6 +19,7 @@ object ScalacheckLibrary extends org.scalaexercises.definitions.Library {
1819
override def sections = List(
1920
PropertiesSection,
2021
GeneratorsSection,
22+
ArbitrarySection,
2123
ScalacheckDatetimeSection
2224
)
2325

src/test/scala/scalachecklib/ArbitrarySpec.scala

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
78

8-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
10+
import org.scalaexercises.Test
911
import org.scalatest.FunSuite
10-
import org.scalatest.prop.Checkers
12+
import org.scalatestplus.scalacheck.Checkers
1113
import shapeless.HNil
1214

1315
class ArbitrarySpec extends FunSuite with Checkers {

src/test/scala/scalachecklib/GeneratorsSpec.scala

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
78

8-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
10+
import org.scalaexercises.Test
911
import org.scalatest.FunSuite
10-
import org.scalatest.prop.Checkers
12+
import org.scalatestplus.scalacheck.Checkers
1113
import shapeless.HNil
1214

1315
class GeneratorsSpec extends FunSuite with Checkers {

src/test/scala/scalachecklib/PropertiesSpec.scala

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
78

8-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
10+
import org.scalaexercises.Test
911
import org.scalatest.FunSuite
10-
import org.scalatest.prop.Checkers
12+
import org.scalatestplus.scalacheck.Checkers
1113
import shapeless.HNil
1214

1315
class PropertiesSpec extends FunSuite with Checkers {

src/test/scala/scalachecklib/ScalacheckDatetimeSpec.scala

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
/*
2-
* scala-exercises - exercises-scalacheck
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-scalacheck
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package scalachecklib
78

8-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
10+
import org.scalaexercises.Test
911
import org.scalatest.FunSuite
10-
import org.scalatest.prop.Checkers
12+
import org.scalatestplus.scalacheck.Checkers
1113
import shapeless.HNil
1214

1315
class ScalacheckDatetimeSpec extends FunSuite with Checkers {

0 commit comments

Comments
 (0)