Skip to content

Commit dd6ab76

Browse files
committed
Removed deprecation warnings from main project and tests
1 parent 6103324 commit dd6ab76

Some content is hidden

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

42 files changed

+139
-176
lines changed

build.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ lazy val stdlib = (project in file("."))
1010
libraryDependencies ++= Seq(
1111
dep("exercise-compiler"),
1212
dep("definitions"),
13-
%%("shapeless"),
14-
%%("scalatest"),
15-
%%("scalacheck"),
16-
%%("scheckShapeless")
13+
"com.chuusai" %% "shapeless" % "2.3.3",
14+
"org.scalatest" %% "scalatest" % V.scalatest,
15+
"org.scalacheck" %% "scalacheck" % V.scalacheck,
16+
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless
1717
)
1818
)
1919

project/ProjectPlugin.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ object ProjectPlugin extends AutoPlugin {
1616
object autoImport {
1717

1818
lazy val V = new {
19-
val scala212: String = "2.12.10"
19+
val scala212: String = "2.12.10"
20+
val shapeless: String = "2.3.3"
21+
val scalatest: String = "3.0.8"
22+
val scalacheck: String = "1.14.2"
23+
val scalacheckShapeless: String = "1.2.3"
2024
}
2125
}
2226

src/main/scala/stdlib/Extractors.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
7171
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)
7272

7373
object ChopShop {
74-
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
74+
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
7575
}
7676

7777
val ChopShop(a, b, c, d) = new Car("Chevy", "Camaro", 1978, 120)
@@ -88,7 +88,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
8888
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)
8989

9090
object ChopShop {
91-
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
91+
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
9292
}
9393

9494
val x = new Car("Chevy", "Camaro", 1978, 120) match {
@@ -106,7 +106,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
106106
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)
107107

108108
object ChopShop {
109-
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
109+
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
110110
}
111111

112112
val x = new Car("Chevy", "Camaro", 1978, 120) match {
@@ -125,9 +125,9 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
125125
class Employee(val firstName: String, val middleName: Option[String], val lastName: String)
126126

127127
object Tokenizer {
128-
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
128+
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
129129

130-
def unapply(x: Employee) = Some(x.firstName, x.lastName)
130+
def unapply(x: Employee) = Some((x.firstName, x.lastName))
131131
}
132132

133133
val result = new Employee("Kurt", None, "Vonnegut") match {
@@ -142,7 +142,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
142142
*/
143143
def anyObjectExtractors(res0: String) {
144144
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short) {
145-
def unapply(x: Car) = Some(x.make, x.model)
145+
def unapply(x: Car) = Some((x.make, x.model))
146146
}
147147

148148
val camaro = new Car("Chevy", "Camaro", 1978, 122)
@@ -168,7 +168,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
168168
//factory methods, extractors, apply
169169
//Extractor: Create tokens that represent your object
170170
def unapply(x: Employee) =
171-
Some(x.lastName, x.middleName, x.firstName)
171+
Some((x.lastName, x.middleName, x.firstName))
172172
}
173173

174174
val singri = new Employee("Singri", None, "Keerthi")
@@ -193,7 +193,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
193193
//factory methods, extractors, apply
194194
//Extractor: Create tokens that represent your object
195195
def unapply(x: Employee) =
196-
Some(x.lastName, x.middleName, x.firstName)
196+
Some((x.lastName, x.middleName, x.firstName))
197197
}
198198

199199
val singri = new Employee("Singri", None, "Keerthi")

src/main/scala/stdlib/Formatting.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,16 @@ object Formatting extends FlatSpec with Matchers with org.scalaexercises.definit
3333
"%c".format(b) should be(res1)
3434
}
3535

36-
/** Character Literals can be an escape sequence, including octal or hexidecimal:
36+
/** Character Literals can be an escape sequence, including hexidecimal:
3737
*/
38-
def escapeSequenceFormatting(res0: String, res1: String, res2: String, res3: String) {
38+
def escapeSequenceFormatting(res0: String, res1: String, res2: String) {
3939
val c = '\u0061' //unicode for a
40-
val d = '\141' //octal for a
4140
val e = '\"'
4241
val f = '\\'
4342

4443
"%c".format(c) should be(res0)
45-
"%c".format(d) should be(res1)
46-
"%c".format(e) should be(res2)
47-
"%c".format(f) should be(res3)
44+
"%c".format(e) should be(res1)
45+
"%c".format(f) should be(res2)
4846
}
4947

5048
/** Formatting can also include numbers:

src/main/scala/stdlib/LiteralStrings.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ object LiteralStrings extends FlatSpec with Matchers with org.scalaexercises.def
3131
c.toString should be(res0)
3232
}
3333

34-
/** Character literals can use octal as well:
35-
*/
36-
def characterLiteralsOctalLiteralStrings(res0: String) {
37-
val d = '\141' //octal for a
38-
d.toString should be(res0)
39-
}
40-
4134
/** Character literals can use escape sequences:
4235
*/
4336
def escapeSequenceLiteralStrings(res0: String, res1: String) {

src/main/scala/stdlib/Traversables.scala

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -424,54 +424,38 @@ object Traversables extends FlatSpec with Matchers with org.scalaexercises.defin
424424
result should be(res0)
425425
}
426426

427-
/** `/:` or `foldLeft` will combine an operation starting with a seed and combining from the left. `foldLeft` is defined as (seed /: list), where seed is the initial value. Once the fold is established, you provide a function that takes two arguments. The first argument is the running total of the operation, and the second element is the next element of the list.
427+
/** `foldLeft` will combine an operation starting with a seed and combining from the left. `foldLeft` takes as a first parameter the initial value of the fold. Once the fold is established, you provide a function that takes two arguments. The first argument is the running total of the operation, and the second element is the next element of the list.
428428
*
429429
* Given a `Traversable (x1, x2, x3, x4)`, an initial value of `init`, an operation `op`, `foldLeft` is defined as: `(((init op x1) op x2) op x3) op x4)`
430430
*/
431-
def foldLeftFunctionTraversables(res0: Int, res1: Int, res2: Int, res3: Int, res4: Int) {
431+
def foldLeftFunctionTraversables(res0: Int, res1: Int, res2: Int) {
432432
val list = List(5, 4, 3, 2, 1)
433-
val result = (0 /: list) { (`running total`, `next element`)
433+
val result = list.foldLeft(0) { (`running total`, `next element`)
434434
`running total` - `next element`
435435
}
436436
result should be(res0)
437437

438-
val result2 = list.foldLeft(0) { (`running total`, `next element`)
439-
`running total` - `next element`
440-
}
438+
val result2 = list.foldLeft(0)(_ - _) //Short hand
441439
result2 should be(res1)
442440

443-
val result3 = (0 /: list)(_ - _) //Short hand
444-
result3 should be(res2)
445-
446-
val result4 = list.foldLeft(0)(_ - _)
447-
result4 should be(res3)
448-
449-
(((((0 - 5) - 4) - 3) - 2) - 1) should be(res4)
441+
(((((0 - 5) - 4) - 3) - 2) - 1) should be(res2)
450442
}
451443

452-
/** `:\` or `foldRight` will combine an operation starting with a seed and combining from the right. Fold right is defined as (list :\ seed), where seed is the initial value. Once the fold is established, you provide a function that takes two elements. The first is the next element of the list, and the second element is the running total of the operation.
444+
/** `foldRight` will combine an operation starting with a seed and combining from the right. `foldRight` takes as a first parameter the initial value of the fold. Once the fold is established, you provide a function that takes two elements. The first is the next element of the list, and the second element is the running total of the operation.
453445
*
454446
* Given a `Traversable (x1, x2, x3, x4)`, an initial value of `init`, an operation `op`, `foldRight` is defined as: `x1 op (x2 op (x3 op (x4 op init)))`
455447
*/
456-
def foldRightFunctionTraversables(res0: Int, res1: Int, res2: Int, res3: Int, res4: Int) {
448+
def foldRightFunctionTraversables(res0: Int, res1: Int, res2: Int) {
457449
val list = List(5, 4, 3, 2, 1)
458-
val result = (list :\ 0) { (`next element`, `running total`)
450+
val result = list.foldRight(0) { (`next element`, `running total`)
459451
`next element` - `running total`
460452
}
461453
result should be(res0)
462454

463-
val result2 = list.foldRight(0) { (`next element`, `running total`)
464-
`next element` - `running total`
465-
}
455+
val result2 = list.foldRight(0)(_ - _) //Short hand
466456
result2 should be(res1)
467457

468-
val result3 = (list :\ 0)(_ - _) //Short hand
469-
result3 should be(res2)
470-
471-
val result4 = list.foldRight(0)(_ - _)
472-
result4 should be(res3)
473-
474-
(5 - (4 - (3 - (2 - (1 - 0))))) should be(res4)
458+
(5 - (4 - (3 - (2 - (1 - 0))))) should be(res2)
475459
}
476460

477461
/** `reduceLeft` is similar to `foldLeft`, except that the seed is the head value:

src/test/scala/stdlib/AssertsSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class AssertsSpec extends Spec with Checkers {
15+
class AssertsSpec extends RefSpec with Checkers {
1616
def `scalatest asserts` =
1717
check(Test.testSuccess(Asserts.scalaTestAsserts _, true :: HNil))
1818

src/test/scala/stdlib/ByNameParameterSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class ByNameParameterSpec extends Spec with Checkers {
15+
class ByNameParameterSpec extends RefSpec with Checkers {
1616
def `takes unit by name parameter` = {
1717
val right: Either[Throwable, Int] = Right(29)
1818

src/test/scala/stdlib/CaseClassesSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class CaseClassesSpec extends Spec with Checkers {
15+
class CaseClassesSpec extends RefSpec with Checkers {
1616
def `case classes comparisons` = {
1717
check(
1818
Test.testSuccess(

src/test/scala/stdlib/ClassesSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class ClassesSpec extends Spec with Checkers {
15+
class ClassesSpec extends RefSpec with Checkers {
1616
def `classes with val parameters` = {
1717
check(
1818
Test.testSuccess(

src/test/scala/stdlib/EmptyValuesSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class EmptyValuesSpec extends Spec with Checkers {
15+
class EmptyValuesSpec extends RefSpec with Checkers {
1616
def `empty values` = {
1717
check(
1818
Test.testSuccess(

src/test/scala/stdlib/EnumerationsSpec.scala

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/test/scala/stdlib/ExtractorsSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class ExtractorsSpec extends Spec with Checkers {
15+
class ExtractorsSpec extends RefSpec with Checkers {
1616
def `extractors` = {
1717
check(
1818
Test.testSuccess(

src/test/scala/stdlib/ForExpressionsSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class ForExpressionsSpec extends Spec with Checkers {
15+
class ForExpressionsSpec extends RefSpec with Checkers {
1616

1717
def `nested for expressions` = {
1818
check(

src/test/scala/stdlib/FormattingSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class FormattingSpec extends Spec with Checkers {
15+
class FormattingSpec extends RefSpec with Checkers {
1616
def `strings` = {
1717
check(
1818
Test.testSuccess(
@@ -35,7 +35,7 @@ class FormattingSpec extends Spec with Checkers {
3535
check(
3636
Test.testSuccess(
3737
Formatting.escapeSequenceFormatting _,
38-
"a" :: "a" :: "\"" :: "\\" :: HNil
38+
"a" :: "\"" :: "\\" :: HNil
3939
)
4040
)
4141
}

src/test/scala/stdlib/HigherOrderFunctionsSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class HigherOrderFunctionsSpec extends Spec with Checkers {
15+
class HigherOrderFunctionsSpec extends RefSpec with Checkers {
1616
def `anonymous function` = {
1717
check(
1818
Test.testSuccess(

src/test/scala/stdlib/ImplicitsSpec.scala

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

77
package stdlib
88

9-
import org.scalacheck.Shapeless._
9+
import org.scalacheck.ScalacheckShapeless._
1010
import org.scalaexercises.Test
11-
import org.scalatest.Spec
11+
import org.scalatest.refspec.RefSpec
1212
import org.scalatest.prop.Checkers
1313
import shapeless.HNil
1414

15-
class ImplicitsSpec extends Spec with Checkers {
15+
class ImplicitsSpec extends RefSpec with Checkers {
1616
def `implicit parameters` = {
1717
check(
1818
Test.testSuccess(

0 commit comments

Comments
 (0)