Skip to content

Commit 9d4a8af

Browse files
authored
Merge pull request #74 from hellrich/patch-1
Removed superfluous repetition
2 parents ab7b69b + abe668a commit 9d4a8af

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/main/scala/stdlib/Objects.scala

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,16 @@ object Objects extends FlatSpec with Matchers with org.scalaexercises.definition
99

1010
/** 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:
1111
*/
12-
def singletonObjects(res0: String, res1: String, res2: String, res3: String) {
12+
def singletonObjects(res0: String, res1: String) {
1313
object Greeting {
1414
def english = "Hi"
1515

1616
def espanol = "Hola"
1717

18-
def deutsch = "Hallo"
19-
20-
def magyar = "Szia"
2118
}
2219

2320
Greeting.english should be(res0)
2421
Greeting.espanol should be(res1)
25-
Greeting.deutsch should be(res2)
26-
Greeting.magyar should be(res3)
2722
}
2823

2924
/** Here is a proof that an object is a singleton, and not a static method in a class:
@@ -33,10 +28,6 @@ object Objects extends FlatSpec with Matchers with org.scalaexercises.definition
3328
def english = "Hi"
3429

3530
def espanol = "Hola"
36-
37-
def deutsch = "Hallo"
38-
39-
def magyar = "Szia"
4031
}
4132

4233
val x = Greeting
@@ -71,7 +62,7 @@ object Objects extends FlatSpec with Matchers with org.scalaexercises.definition
7162

7263
/** A companion object can also see private values and variables of the corresponding classes' instantiated objects:
7364
*/
74-
def privateValuesObjects(res0: String, res1: String, res2: String, res3: String) {
65+
def privateValuesObjects(res0: String, res1: String) {
7566
class Person(val name: String, private val superheroName: String) //The superhero name is private!
7667

7768
object Person {
@@ -80,13 +71,9 @@ object Objects extends FlatSpec with Matchers with org.scalaexercises.definition
8071

8172
val clark = new Person("Clark Kent", "Superman")
8273
val peter = new Person("Peter Parker", "Spiderman")
83-
val bruce = new Person("Bruce Wayne", "Batman")
84-
val diana = new Person("Diana Prince", "Wonder Woman")
8574

8675
Person.showMeInnerSecret(clark) should be(res0)
8776
Person.showMeInnerSecret(peter) should be(res1)
88-
Person.showMeInnerSecret(bruce) should be(res2)
89-
Person.showMeInnerSecret(diana) should be(res3)
9077
}
9178

9279
}

src/test/scala/stdlib/ObjectsSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ObjectsSpec extends Spec with Checkers {
1111
check(
1212
Test.testSuccess(
1313
Objects.singletonObjects _,
14-
"Hi" :: "Hola" :: "Hallo" :: "Szia" :: HNil
14+
"Hi" :: "Hola" :: HNil
1515
)
1616
)
1717
}
@@ -48,7 +48,7 @@ class ObjectsSpec extends Spec with Checkers {
4848
check(
4949
Test.testSuccess(
5050
Objects.privateValuesObjects _,
51-
"Superman" :: "Spiderman" :: "Batman" :: "Wonder Woman" :: HNil
51+
"Superman" :: "Spiderman" :: HNil
5252
)
5353
)
5454
}

0 commit comments

Comments
 (0)