Skip to content

Commit 4ddc0b6

Browse files
committed
edit online feature is the #1 enemy of TDD
1 parent e3af6d2 commit 4ddc0b6

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/main/scala/stdlib/Lists.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ object Lists extends FlatSpec with Matchers with org.scalaexercises.definitions.
159159
val a = (1 to 5).toList
160160
a should be(res0)
161161
}
162-
162+
163163
/** You can prepend elements to a List to get a new List:
164164
*/
165165
def addElementsLists(res0: List[Int]) {
@@ -170,17 +170,14 @@ object Lists extends FlatSpec with Matchers with org.scalaexercises.definitions.
170170

171171
/** Lists can be concatened and Nil is an empty List:
172172
*/
173-
def concatenateLists(
174-
res0: List[Int],
175-
res1: List[Int]) {
173+
def concatenateLists(res0: List[Int], res1: List[Int]) {
176174
val head = List(1, 3)
177175
val tail = List(5, 7)
178176

179177
head ::: tail should be(res0)
180178
head ::: Nil should be(res1)
181179
}
182180

183-
184181
/** Lists reuse their tails:
185182
*/
186183
def reuseTailsLists(

src/test/scala/stdlib/ListsSpec.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,24 @@ class ListsSpec extends Spec with Checkers {
129129
)
130130
}
131131

132+
def `add elements` = {
133+
check(
134+
Test.testSuccess(
135+
Lists.addElementsLists _,
136+
List(0, 1, 3, 5, 7) :: HNil
137+
)
138+
)
139+
}
140+
141+
def `concatenate lists` = {
142+
check(
143+
Test.testSuccess(
144+
Lists.concatenateLists _,
145+
List(1, 3, 5, 7) :: List(1, 3) :: HNil
146+
)
147+
)
148+
}
149+
132150
def `lists share tails` = {
133151
check(
134152
Test.testSuccess(

0 commit comments

Comments
 (0)