Skip to content

Commit 6d33ce0

Browse files
committed
Add more show tests
1 parent b9c6290 commit 6d33ce0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

library/test/dotty/ShowTests.scala

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class ShowTests {
5353

5454
@Test def showOptions = {
5555
assertEquals("None", None.show)
56+
val empty = Option.empty
57+
assertEquals("None", empty.show)
5658
assertEquals("None", (None: Option[String]).show)
5759
assertEquals("Some(\"hello opt\")", Some("hello opt").show)
5860
}
@@ -65,8 +67,6 @@ class ShowTests {
6567
@Test def withoutShow = {
6668
case class Car(model: String, manufacturer: String, year: Int)
6769
assertEquals("Car(Mustang,Ford,1967)", Car("Mustang", "Ford", 1967).show)
68-
assertEquals("Map()", Map[Nothing, Nothing]().show)
69-
assertEquals("List()", List().show)
7070
}
7171

7272
@Test def partialShow = {
@@ -79,4 +79,16 @@ class ShowTests {
7979
assertEquals("Array(1)", Array(1).show)
8080
assertEquals("Array(1, 2, 3)", Array(1, 2, 3).show)
8181
}
82+
83+
@Test def showNull = {
84+
assertEquals("null", (null: String).show)
85+
assertEquals("List(null)", List(null).show)
86+
assertEquals("List(null)", List[String](null).show)
87+
}
88+
89+
@Test def showNothing = {
90+
val emptyMap = Map()
91+
assertEquals("Map()", emptyMap.show)
92+
assertEquals("List()", List().show)
93+
}
8294
}

0 commit comments

Comments
 (0)