Skip to content

Commit aafecd0

Browse files
authored
Merge pull request #153 from scala-exercises/enrique-2-12-10-update
Updated ScalaTest 3.1.0
2 parents f3b1d3e + 9023eba commit aafecd0

38 files changed

+136
-74
lines changed

build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ lazy val stdlib = (project in file("."))
1313
%%("shapeless", V.shapeless),
1414
%%("scalatest", V.scalatest),
1515
%%("scalacheck", V.scalacheck),
16-
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless
16+
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless,
17+
"org.scalatestplus" %% "scalatestplus-scalacheck" % V.scalatestplusScheck
1718
)
1819
)
1920

project/ProjectPlugin.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ object ProjectPlugin extends AutoPlugin {
1818
lazy val V = new {
1919
val scala212: String = "2.12.10"
2020
val shapeless: String = "2.3.3"
21-
val scalatest: String = "3.0.8"
21+
val scalatest: String = "3.1.0"
22+
val scalatestplusScheck: String = "3.1.0.0-RC2"
2223
val scalacheck: String = "1.14.2"
2324
val scalacheckShapeless: String = "1.2.3"
2425
}

src/main/scala/stdlib/Asserts.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name asserts
1213
*/
13-
object Asserts extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
14+
object Asserts extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1415

1516
/** ScalaTest makes three assertions available by default in any style trait. You can use:
1617
*

src/main/scala/stdlib/ByNameParameter.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name byname_parameter
1213
*/
13-
object ByNameParameter extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
14+
object ByNameParameter
15+
extends AnyFlatSpec
16+
with Matchers
17+
with org.scalaexercises.definitions.Section {
1418

1519
/** `() => Int` is a Function type that takes a `Unit` type. `Unit` is known as `void` to a Java programmer. The function returns an `Int`. You can place this as a method parameter so that you can you use it as a block, but still it doesn't look quite right:
1620
*/

src/main/scala/stdlib/CaseClasses.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name case_classes
1213
*/
13-
object CaseClasses extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
14+
object CaseClasses extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1415

1516
/** Scala supports the notion of ''case classes''. Case classes are regular classes which export their constructor parameters and which provide a recursive decomposition mechanism via pattern matching.
1617
*

src/main/scala/stdlib/Classes.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name classes
1213
*/
13-
object Classes extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
14+
object Classes extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1415

1516
/** Classes in Scala are static templates that can be instantiated into many objects at runtime.
1617
* Here is a class definition which defines a class Point:

src/main/scala/stdlib/EmptyValues.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name empty_values
1213
*
1314
*/
14-
object EmptyValues extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object EmptyValues extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** ==null==
1718
*

src/main/scala/stdlib/Enumerations.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name enumerations
1213
*
1314
*/
14-
object Enumerations extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object Enumerations extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** To create an enumeration, create an object that extends the abstract class `Enumeration`, and set a `val` variable to the method `Value`. This is a trick to give values to each `val`.
1718
*

src/main/scala/stdlib/Extractors.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name extractors
1213
*
1314
*/
14-
object Extractors extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object Extractors extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** In Scala, patterns can be defined independently of case classes. To this end, a method named `unapply` is defined to yield a so-called extractor.
1718
*

src/main/scala/stdlib/ForExpressions.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name for_expressions
1213
*
1314
*/
14-
object ForExpressions extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object ForExpressions
16+
extends AnyFlatSpec
17+
with Matchers
18+
with org.scalaexercises.definitions.Section {
1519

1620
/** `for` expressions can nest, with later generators varying more rapidly than earlier ones:
1721
*/

src/main/scala/stdlib/Formatting.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name formatting
1213
*
1314
*/
14-
object Formatting extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object Formatting extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** String can be placed in format:
1718
*/

src/main/scala/stdlib/HigherOrderFunctions.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name higher_order_functions
1213
*
1314
*/
1415
object HigherOrderFunctions
15-
extends FlatSpec
16+
extends AnyFlatSpec
1617
with Matchers
1718
with org.scalaexercises.definitions.Section {
1819

src/main/scala/stdlib/Implicits.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011
import scala.language.implicitConversions
1112

1213
/** @param name implicits
1314
*
1415
*/
15-
object Implicits extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
16+
object Implicits extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1617

1718
/** The actual arguments that are eligible to be passed to an implicit parameter fall into two categories:
1819
*

src/main/scala/stdlib/InfixPrefixandPostfixOperators.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011
import scala.language.postfixOps
1112

1213
/** @param name infix_prefix_and_postfix_operators
1314
*
1415
*/
1516
object InfixPrefixandPostfixOperators
16-
extends FlatSpec
17+
extends AnyFlatSpec
1718
with Matchers
1819
with org.scalaexercises.definitions.Section {
1920

src/main/scala/stdlib/InfixTypes.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name infix_types
1213
*
1314
*/
14-
object InfixTypes extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object InfixTypes extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** An infix type `T1 op T2` consists of an infix operator `op` which gets applied to two
1718
* type operands `T1` and `T2`. The type is equivalent to the type application `op[T1,T2]`.

src/main/scala/stdlib/Iterables.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name iterables
1213
*
1314
*/
14-
object Iterables extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object Iterables extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** The next trait from the top in the collections hierarchy is `Iterable`. All methods in this trait are defined in terms of an abstract method, `iterator`, which yields the collection's elements one by one. The `foreach` method from trait `Traversable` is implemented in `Iterable` in terms of `iterator`. Here is the actual implementation:
1718
*

src/main/scala/stdlib/Lists.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name lists
1213
*
1314
*/
14-
object Lists extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object Lists extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** Scala Lists are quite similar to arrays, which means all the elements of a list have the same type - but there are two important differences. First, lists are immutable, which means elements of a list cannot be changed by assignment. Second, lists represent a linked list whereas arrays are flat. The type of a list that has elements of type `T` is written as `List[T]`.
1718
*

src/main/scala/stdlib/LiteralBooleans.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name literal_booleans
1213
*
1314
*/
14-
object LiteralBooleans extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object LiteralBooleans
16+
extends AnyFlatSpec
17+
with Matchers
18+
with org.scalaexercises.definitions.Section {
1519

1620
/** Boolean literals are either true or false, using the `true` or `false` keyword:
1721
*/

src/main/scala/stdlib/LiteralNumbers.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name literal_numbers
1213
*
1314
*/
14-
object LiteralNumbers extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object LiteralNumbers
16+
extends AnyFlatSpec
17+
with Matchers
18+
with org.scalaexercises.definitions.Section {
1519

1620
/** Integer literals are 32-bit and can be created from decimals as well as hexadecimals:
1721
*/

src/main/scala/stdlib/LiteralStrings.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name literal_strings
1213
*
1314
*/
14-
object LiteralStrings extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object LiteralStrings
16+
extends AnyFlatSpec
17+
with Matchers
18+
with org.scalaexercises.definitions.Section {
1519

1620
/** Character literals are quoted with single quotes:
1721
*/

src/main/scala/stdlib/Maps.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name maps
1213
*
1314
*/
14-
object Maps extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object Maps extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** A `Map` is an `Iterable` consisting of pairs of keys and values (also named mappings or associations). Scala's Predef class offers an implicit conversion that lets you write `key -> value` as an alternate syntax for the pair `(key, value)`. For instance `Map("x" -> 24, "y" -> 25, "z" -> 26)` means exactly the same as `Map(("x", 24), ("y", 25), ("z", 26))`, but reads better.
1718
*

src/main/scala/stdlib/NamedandDefaultArguments.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
package stdlib
88

99
import NamedandDefaultArgumentsHelper._
10-
import org.scalatest._
10+
import org.scalatest.flatspec.AnyFlatSpec
11+
import org.scalatest.matchers.should.Matchers
1112

1213
/** @param name named_and_default_arguments
1314
*
1415
*/
1516
object NamedandDefaultArguments
16-
extends FlatSpec
17+
extends AnyFlatSpec
1718
with Matchers
1819
with org.scalaexercises.definitions.Section {
1920

src/main/scala/stdlib/Objects.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
package stdlib
88

9-
import org.scalatest._
9+
import org.scalatest.flatspec.AnyFlatSpec
10+
import org.scalatest.matchers.should.Matchers
1011

1112
/** @param name objects
1213
*
1314
*/
14-
object Objects extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
15+
object Objects extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1516

1617
/** An object is a singleton. One object, that's it. This object is a replacement of static in Java, and is called upon much in the same way:
1718
*/

src/main/scala/stdlib/Options.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
package stdlib
88

99
import OptionsHelper._
10-
import org.scalatest._
10+
import org.scalatest.flatspec.AnyFlatSpec
11+
import org.scalatest.matchers.should.Matchers
1112

1213
/** @param name options
1314
*
1415
*/
15-
object Options extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
16+
object Options extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {
1617

1718
/** If you have worked with Java at all in the past, it is very likely that you have come across a `NullPointerException` at some time (other languages will throw similarly named errors in such a case). Usually this happens because some method returns null when you were not expecting it and thus not dealing with that possibility in your client code. A value of `null` is often abused to represent an absent optional value.
1819
*

0 commit comments

Comments
 (0)