summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan@lightbend.com>2016-10-20 12:08:49 -0700
committerAdriaan Moors <adriaan@lightbend.com>2016-10-20 12:08:49 -0700
commit0b131f48a0ad2b25275a3050a0c485519633943d (patch)
treebf697994ea22ab4414fca9ab22b98024fd9ae8fc
parent7c350182effde045beb7b0c47e02e8c11c9e3a88 (diff)
parentf66ed4d4f798fa693f87702769252ddfc6b81cf3 (diff)
downloadscala-0b131f48a0ad2b25275a3050a0c485519633943d.tar.gz
scala-0b131f48a0ad2b25275a3050a0c485519633943d.tar.bz2
scala-0b131f48a0ad2b25275a3050a0c485519633943d.zip
Merge 2.11.x into 2.12.x
Include PRs #5464, #5467
-rw-r--r--test/junit/scala/tools/nsc/settings/SettingsTest.scala40
1 files changed, 22 insertions, 18 deletions
diff --git a/test/junit/scala/tools/nsc/settings/SettingsTest.scala b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
index db8d083835..24bfb3dcde 100644
--- a/test/junit/scala/tools/nsc/settings/SettingsTest.scala
+++ b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
@@ -181,6 +181,12 @@ class SettingsTest {
assertThrows[IllegalArgumentException](check(expected = "2.11", "-Xsource:2.invalid"), _ contains "Bad version (2.invalid)")
}
+ // equal with stripped margins and normalized line endings
+ private def marginallyEquals(s1: String, s2: String): Boolean = {
+ def normally(s: String): String = s.stripMargin.lines.mkString("\n")
+ normally(s1) == normally(s2)
+ }
+
@Test def helpHasDefault(): Unit = {
val s = new MutableSettings(msg => throw new IllegalArgumentException(msg))
object mChoices extends s.MultiChoiceEnumeration {
@@ -201,15 +207,14 @@ class SettingsTest {
assertTrue(check("-m")(_.value == Set(b)))
assertTrue(check("-m") { _ =>
- assertEquals(
- """magic sauce
- | a help a
- | b help b
- | c help c
- |Default: b
- |""".stripMargin,
- m.help)
- true
+ val expected =
+ """|magic sauce
+ | a help a
+ | b help b
+ | c help c
+ |Default: b
+ |"""
+ marginallyEquals(expected, m.help)
})
}
@Test def helpHasDefaultAll(): Unit = {
@@ -232,15 +237,14 @@ class SettingsTest {
assertTrue(check("-m")(_.value == Set(a, b, c)))
assertTrue(check("-m") { _ =>
- assertEquals(
- """magic sauce
- | a help a
- | b help b
- | c help c
- |Default: All choices are enabled by default.
- |""".stripMargin,
- m.help)
- true
+ val expected =
+ """|magic sauce
+ | a help a
+ | b help b
+ | c help c
+ |Default: All choices are enabled by default.
+ |"""
+ marginallyEquals(expected, m.help)
})
}
}