Skip to content

Commit 582a3f5

Browse files
authored
Bump Scala to version 2.13 and scalatest to version 3.2.10 (#712)
* Update version of sbt and scala for testgen - This is from `2.12` -> `2.13` - Adds `import scala.language.postfixOps` where needed - Changes test generation for new version of `scalatest` * Update scala version to 2.13.6 - This is a change in each `exercise/**/build.sbt` * Updates `scalatest` to `3.2.10` * Fixes two issues in `build.sbt` - adds missing newlines for `exercises/**/build.sbt` - imports play-json correctly in `build.sbt` * Updates exercises for `scalatest` version bump - `scalatest` is no longer monolithic, specific things must be imported - `FunSuite` renamed to `AnyFunSuite` - `FlatSpec` renamed to `AnyFlatSpec` - `Matchers` used throughout were moved and refactored, these tests use `org.scalatest.matchers.should.Matchers` See the [ScalaTest 3.2.0 release notes](https://www.scalatest.org/release_notes/3.2.0) for details on what was deprecated. * Updates `INSTALLATION.md` - Added callout to use SDKMAN - Updated JDK Requirement to be JDK 11 - Updated sbt and Scala requirements
1 parent 17905da commit 582a3f5

File tree

204 files changed

+616
-408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+616
-408
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ bin/configlet
88
bin/configlet.exe
99

1010
.bsp/
11+
12+
# metals workflow junk, shouldn't be commited
13+
.bloop/
14+
.metals/
15+
1116
project/
17+
!project/build.properties
18+
!project/plugins.sbt
1219
project/target
1320
src/test/scala/project/
1421
target

docs/INSTALLATION.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
In addition to the exercism CLI and your favorite text editor, practicing with Exercism exercises in Scala requires:
55

6-
* Recent build of the Java 8 Platform, such as [OpenJDK](http://openjdk.java.net/install/) or [Oracle Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
7-
* [Download](http://www.scala-sbt.org/release/docs/Setup.html) and install the Simple Build Tool (`sbt`)
6+
* Java Development Kit (JDK) 11 or later. Use your preferred vendor or grab one from [Adoptium](https://adoptium.net/)
7+
* [Scala 2.13.x](https://www.scala-lang.org/download/scala2.html)
8+
* [sbt 1.6.x](https://www.scala-sbt.org/download.html)
9+
10+
If you don't want install these various dependencies by hand, consider using [SDKMAN](https://sdkman.io/) to manage your java and java-adjacent development tools and libraries.
811

912
---
1013

@@ -18,4 +21,6 @@ To get started, see "[Running the Tests](http://exercism.io/languages/scala/test
1821

1922
* [IntelliJ IDEA with Scala Plugin](https://www.jetbrains.com/idea/)
2023
* [ScalaIDE](http://scala-ide.org/index.html)
21-
* [NetBeans with Scala Plugin](https://netbeans.org/)
24+
* [NetBeans with Scala Plugin](https://netbeans.org/)
25+
* [Metals with VS Code](https://scalameta.org/metals/docs/editors/vscode)
26+
* [Metals with Vim or Neovim](https://scalameta.org/metals/docs/editors/vim)

exercises/concept/basics/src/test/scala/LasagnaTest.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
14
/** @version 1.3.0 */
2-
class LasagnaTest extends FunSuite with Matchers {
5+
class LasagnaTest extends AnyFunSuite with Matchers {
36

47
test("expected minutes in oven") {
58
new Lasagna().expectedMinutesInOven() should be(40)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/accumulate/src/test/scala/AccumulateTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FlatSpec}
1+
import org.scalatest.matchers.should.Matchers
2+
import org.scalatest.flatspec.AnyFlatSpec
3+
24

35
/** @version created manually **/
4-
class AccumulateTest extends FlatSpec with Matchers {
6+
class AccumulateTest extends AnyFlatSpec with Matchers {
57

68
it should "allow empty accumulation" in {
79
val accumulate = new Accumulate

exercises/practice/acronym/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/acronym/src/test/scala/AcronymTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.6.0 */
4-
class AcronymTest extends FunSuite with Matchers {
6+
class AcronymTest extends AnyFunSuite with Matchers {
57

68
test("basic") {
79
Acronym.abbreviate("Portable Network Graphics") should be ("PNG")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/all-your-base/src/test/scala/AllYourBaseTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 2.3.0 */
4-
class AllYourBaseTest extends FunSuite with Matchers {
6+
class AllYourBaseTest extends AnyFunSuite with Matchers {
57

68
test("single bit one to decimal") {
79
AllYourBase.rebase(2, List(1), 10) should be(Some(List(1)))
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/allergies/src/test/scala/AllergiesTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.2.0 */
4-
class AllergiesTest extends FunSuite with Matchers {
6+
class AllergiesTest extends AnyFunSuite with Matchers {
57

68
test("Allergen.Peanuts - no allergies means not allergic") {
79
Allergies.allergicTo(Allergen.Peanuts, 0) should be(false)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"
44
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.5"
55

exercises/practice/alphametics/src/test/scala/AlphameticsTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.3.0 */
4-
class AlphameticsTest extends FunSuite with Matchers {
6+
class AlphameticsTest extends AnyFunSuite with Matchers {
57

68
test("puzzle with three letters") {
79
Alphametics.solve("I + BB == ILL") should be(

exercises/practice/anagram/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"
44

exercises/practice/anagram/src/test/scala/AnagramTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.4.0 */
4-
class AnagramTest extends FunSuite with Matchers {
6+
class AnagramTest extends AnyFunSuite with Matchers {
57

68
test("no matches") {
79
Anagram.findAnagrams("diaper", List("hello", "world", "zombies", "pants")) should be(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/armstrong-numbers/src/test/scala/ArmstrongNumbersTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.0.0 */
4-
class ArmstrongNumbersTest extends FunSuite with Matchers {
6+
class ArmstrongNumbersTest extends AnyFunSuite with Matchers {
57

68
test("Single digit numbers are Armstrong numbers") {
79
ArmstrongNumbers.isArmstrongNumber(5) should be (true)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/atbash-cipher/src/test/scala/AtbashCipherTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.2.0 */
4-
class AtbashCipherTest extends FunSuite with Matchers {
6+
class AtbashCipherTest extends AnyFunSuite with Matchers {
57

68
test("encode yes") {
79
AtbashCipher.encode("yes") should be("bvh")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"
44

exercises/practice/bank-account/src/test/scala/BankAccountTest.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import org.scalatest.concurrent.{IntegrationPatience, Conductors}
2-
import org.scalatest.{Matchers, FunSuite}
2+
import org.scalatest.funsuite.AnyFunSuite
3+
import org.scalatest.matchers.should.Matchers
4+
35

46
/** @version created manually **/
5-
class BankAccountTest extends FunSuite with Matchers with Conductors with IntegrationPatience {
7+
class BankAccountTest extends AnyFunSuite with Matchers with Conductors with IntegrationPatience {
68
test("open account") {
79
Bank.openAccount().getBalance should be (Some(0))
810
}
@@ -33,15 +35,15 @@ class BankAccountTest extends FunSuite with Matchers with Conductors with Integr
3335

3436
val acct = Bank.openAccount()
3537

36-
thread("t1") {
38+
threadNamed("t1") {
3739
acct.incrementBalance(10)
3840
acct.getBalance should be (Some(10))
3941
beat should be (1)
4042
waitForBeat(2)
4143
acct.getBalance should be (Some(15))
4244
}
4345

44-
thread("t2") {
46+
threadNamed("t2") {
4547
waitForBeat(1)
4648
acct.getBalance should be (Some(10))
4749
acct.incrementBalance(5)
@@ -57,12 +59,12 @@ class BankAccountTest extends FunSuite with Matchers with Conductors with Integr
5759

5860
val acct = Bank.openAccount()
5961

60-
thread("t1") {
62+
threadNamed("t1") {
6163
for (a <- 1 to 10)
6264
acct.incrementBalance(10)
6365
}
6466

65-
thread("t2") {
67+
threadNamed("t2") {
6668
for (a <- 1 to 10)
6769
acct.incrementBalance(5)
6870
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name := "beer-song"
22
scalaVersion := "2.12.2"
3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/beer-song/src/test/scala/BeerSongTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 2.1.0 */
4-
class BeerSongTest extends FunSuite with Matchers {
6+
class BeerSongTest extends AnyFunSuite with Matchers {
57

68
test("first generic verse") {
79
BeerSong.recite(99, 1) should be(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/binary-search-tree/src/test/scala/BstTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FlatSpec}
1+
import org.scalatest.flatspec.AnyFlatSpec
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version created manually **/
4-
class BstTest extends FlatSpec with Matchers {
6+
class BstTest extends AnyFlatSpec with Matchers {
57
val bst4 = Bst(4)
68

79
it should "retain data" in {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/binary-search/src/test/scala/BinarySearchTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.3.0 */
4-
class BinarySearchTest extends FunSuite with Matchers {
6+
class BinarySearchTest extends AnyFunSuite with Matchers {
57

68
test("finds a value in an array with one element") {
79
BinarySearch.find(List(6), 6) should be(Some(0))

exercises/practice/binary/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

33
libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.5" % "test"

exercises/practice/binary/src/test/scala/BinaryTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
23

3-
class BinaryTest extends FunSuite with Matchers {
4+
5+
class BinaryTest extends AnyFunSuite with Matchers {
46
test("empty string") {
57
Binary("").toDecimal should be (0)
68
}

exercises/practice/bob/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/bob/src/test/scala/BobTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.4.0 */
4-
class BobTest extends FunSuite with Matchers {
6+
class BobTest extends AnyFunSuite with Matchers {
57

68
test("stating something") {
79
Bob.response("Tom-ay-to, tom-aaaah-to.") should be("Whatever.")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/book-store/src/test/scala/BookStoreTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.4.0 */
4-
class BookStoreTest extends FunSuite with Matchers {
6+
class BookStoreTest extends AnyFunSuite with Matchers {
57

68

79
test("Only a single book") {

exercises/practice/bowling/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/bowling/src/test/scala/BowlingTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.0.1 */
4-
class BowlingTest extends FunSuite with Matchers {
6+
class BowlingTest extends AnyFunSuite with Matchers {
57

68
test("should be able to score a game with all zeros") {
79
val score = List(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).foldLeft(Bowling())((acc, roll) => acc.roll(roll)).score()

exercises/practice/change/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

exercises/practice/change/src/test/scala/ChangeTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import org.scalatest.{Matchers, FunSuite}
1+
import org.scalatest.funsuite.AnyFunSuite
2+
import org.scalatest.matchers.should.Matchers
3+
24

35
/** @version 1.2.0 */
4-
class ChangeTest extends FunSuite with Matchers {
6+
class ChangeTest extends AnyFunSuite with Matchers {
57

68
test("single coin change") {
79
Change.findFewestCoins(25, List(1, 5, 10, 25, 100)) should be (Some(List(25)))

exercises/practice/clock/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
scalaVersion := "2.12.8"
1+
scalaVersion := "2.13.6"
22

3-
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
3+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.10" % "test"

0 commit comments

Comments
 (0)