Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
intro-to-fp
short-exercises
Commits
0cf1eca2
Commit
0cf1eca2
authored
May 08, 2020
by
Alexander Gehrke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run autofix on scalatest deprecation warnings
parent
3c3a0338
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
51 additions
and
17 deletions
+51
-17
src/test/scala/algebra/MonoidsSpec.scala
src/test/scala/algebra/MonoidsSpec.scala
+3
-1
src/test/scala/applicative/ApplicativeSpec.scala
src/test/scala/applicative/ApplicativeSpec.scala
+3
-1
src/test/scala/applicative/ValidatedSpec.scala
src/test/scala/applicative/ValidatedSpec.scala
+3
-1
src/test/scala/datastructures/ListSpec.scala
src/test/scala/datastructures/ListSpec.scala
+3
-1
src/test/scala/errors/EitherSpec.scala
src/test/scala/errors/EitherSpec.scala
+3
-1
src/test/scala/errors/OptionSpec.scala
src/test/scala/errors/OptionSpec.scala
+3
-1
src/test/scala/errors/TeamSpec.scala
src/test/scala/errors/TeamSpec.scala
+3
-1
src/test/scala/laziness/LazyListSpec.scala
src/test/scala/laziness/LazyListSpec.scala
+3
-1
src/test/scala/monads/MonadFunctorSpec.scala
src/test/scala/monads/MonadFunctorSpec.scala
+3
-1
src/test/scala/monads/MonadSpec.scala
src/test/scala/monads/MonadSpec.scala
+3
-1
src/test/scala/parsers/AddressParserSpec.scala
src/test/scala/parsers/AddressParserSpec.scala
+3
-1
src/test/scala/parsers/Many1Spec.scala
src/test/scala/parsers/Many1Spec.scala
+3
-1
src/test/scala/readerwriter/RandomSpec.scala
src/test/scala/readerwriter/RandomSpec.scala
+3
-1
src/test/scala/readerwriter/ReaderSpec.scala
src/test/scala/readerwriter/ReaderSpec.scala
+3
-1
src/test/scala/readerwriter/WriterSpec.scala
src/test/scala/readerwriter/WriterSpec.scala
+3
-1
src/test/scala/typeclasses/FunctorSpec.scala
src/test/scala/typeclasses/FunctorSpec.scala
+3
-1
src/test/scala/typeclasses/ShowSpec.scala
src/test/scala/typeclasses/ShowSpec.scala
+3
-1
No files found.
src/test/scala/algebra/MonoidsSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package algebra
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
MonoidsSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
MonoidsSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"The addditive Int monoid"
should
"have the right zero element"
in
{
Monoids
.
intAddition
.
zero
shouldBe
0
}
...
...
src/test/scala/applicative/ApplicativeSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package applicative
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
ApplicativeSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
ApplicativeSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
implicit
val
optionApplicative
=
new
Applicative
[
Option
]
{
override
def
pure
[
A
](
a
:
A
)
:
Option
[
A
]
=
Some
(
a
)
override
def
ap
[
A
,
B
](
ff
:
Option
[
A
=>
B
])(
fa
:
Option
[
A
])
:
Option
[
B
]
=
ff
.
flatMap
(
f
=>
fa
.
map
(
f
))
...
...
src/test/scala/applicative/ValidatedSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package applicative
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
ValidatedSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
ValidatedSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"map2"
should
"accumulate errors"
in
{
type
VSI
=
Validated
[
String
,
Int
]
val
valid1
:
VSI
=
Valid
(
1
)
...
...
src/test/scala/datastructures/ListSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package datastructures
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
ListSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
ListSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
val
numbers
=
List
(
1
to
5
:
_
*
)
val
single
=
List
(
1
)
val
strings
=
List
(
"a"
,
"b"
,
"c"
)
...
...
src/test/scala/errors/EitherSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package errors
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
EitherSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
EitherSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
val
l1
:
Either
[
Int
,
Int
]
=
Left
(
1
)
val
l2
:
Either
[
Int
,
Int
]
=
Left
(
2
)
val
r1
:
Either
[
Int
,
Int
]
=
Right
(
1
)
...
...
src/test/scala/errors/OptionSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package errors
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
OptionSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
OptionSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"An option"
should
"have a map function which transforms it's content"
in
{
Some
(
3
).
map
(
_
+
1
)
shouldBe
Some
(
4
)
}
...
...
src/test/scala/errors/TeamSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package errors
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
TeamSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
TeamSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"getTeam"
should
"return both persons ore none"
in
{
Team
.
getTeam
(
"blar"
,
"Dagobert"
)
shouldBe
None
Team
.
getTeam
(
"Daniel"
,
"Dagobert"
)
shouldBe
Some
((
Team
.
persons
(
2
),
Team
.
persons
(
0
)))
...
...
src/test/scala/laziness/LazyListSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package laziness
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
LazyListSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
LazyListSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
import
LazyList._
...
...
src/test/scala/monads/MonadFunctorSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package monads
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
MonadFunctorSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
MonadFunctorSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"functorFromMonad"
should
"return a working functor"
in
{
Functor
.
functorFromMonad
[
Option
](
new
Monad
[
Option
]
{
def
pure
[
A
](
a
:
A
)
:
Option
[
A
]
=
Some
(
a
)
...
...
src/test/scala/monads/MonadSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package monads
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
MonadSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
MonadSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"map2"
should
"combine two monadic values"
in
{
tupleMonad
.
map2
(
Tuple1
(
1
),
Tuple1
(
2
))((
a
,
b
)
=>
a
+
b
)
shouldBe
Tuple1
(
3
)
}
...
...
src/test/scala/parsers/AddressParserSpec.scala
View file @
0cf1eca2
...
...
@@ -5,8 +5,10 @@ import parsers.ContactParser.address
import
parsers.lib.Parsers._
import
parsers.lib._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
AddressParserSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
AddressParserSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"The address parser"
should
"match an address of the form <street> <number>, <code> <city>"
in
{
address
.
parse
(
"Hublandstraße 123, 97074 Würzburg"
)
shouldBe
Done
(
""
,
Address
(
"Hublandstraße"
,
123
,
97074
,
"Würzburg"
))
}
...
...
src/test/scala/parsers/Many1Spec.scala
View file @
0cf1eca2
...
...
@@ -5,8 +5,10 @@ import parsers.Combinators.many1
import
parsers.lib.Parsers._
import
parsers.lib._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
Many1Spec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
Many1Spec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"the many1 combinator"
should
"match a single match of the given parser"
in
{
many1
(
string
(
"a"
)).
parse
(
"abc"
)
shouldBe
Done
(
"bc"
,
NonEmptyList
(
"a"
,
Nil
))
}
...
...
src/test/scala/readerwriter/RandomSpec.scala
View file @
0cf1eca2
...
...
@@ -2,8 +2,10 @@ package readerwriter
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
RandomSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
RandomSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
val
initial
=
Simple
(
192837465L
)
val
(
r1
,
i1
)
=
initial
.
nextInt
val
(
r2
,
i2
)
=
r1
.
nextInt
...
...
src/test/scala/readerwriter/ReaderSpec.scala
View file @
0cf1eca2
...
...
@@ -3,8 +3,10 @@ package readerwriter
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
java.time.LocalDate
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
ReaderSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
ReaderSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
val
exampleRequest
=
Request
(
Some
(
"Mister X"
),
"de-DE"
,
...
...
src/test/scala/readerwriter/WriterSpec.scala
View file @
0cf1eca2
...
...
@@ -4,8 +4,10 @@ import java.time.LocalDate
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
class
WriterSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
WriterSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"collatzDepth"
should
"keep a log of the search"
in
{
val
(
log
,
_
)
=
Writers
.
collatzDepth
(
3
).
v
log
shouldBe
List
(
...
...
src/test/scala/typeclasses/FunctorSpec.scala
View file @
0cf1eca2
...
...
@@ -2,9 +2,11 @@ package typeclasses
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
@SuppressWarnings
(
Array
(
"org.wartremover.warts.All"
))
class
FunctorSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
FunctorSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"The Functor instance for Option"
should
"be available in implicit scope"
in
{
"implicitly[Functor[Option]]"
should
compile
}
...
...
src/test/scala/typeclasses/ShowSpec.scala
View file @
0cf1eca2
...
...
@@ -2,9 +2,11 @@ package typeclasses
import
org.scalatest._
import
testutil.PendingIfUnimplemented
import
org.scalatest.flatspec.AnyFlatSpec
import
org.scalatest.matchers.should.Matchers
@SuppressWarnings
(
Array
(
"org.wartremover.warts.All"
))
class
ShowSpec
extends
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
class
ShowSpec
extends
Any
FlatSpec
with
Matchers
with
AppendedClues
with
PendingIfUnimplemented
{
"The Show instance for Person"
should
"be available in implicit scope"
in
{
"implicitly[Show[Person]]"
should
compile
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment