Skip to content

Commit 82f2d3d

Browse files
committed
Clean up syntax in tests
1 parent 705b59c commit 82f2d3d

File tree

8 files changed

+35
-32
lines changed

8 files changed

+35
-32
lines changed

presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionExtensionSuite.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
8686

8787
@Test def `filter-by-type-old` =
8888
check(
89-
"""|package example
89+
"""|package example
9090
|
9191
|object enrichments:
9292
| implicit class A(num: Int):
@@ -99,7 +99,6 @@ class CompletionExtensionSuite extends BaseCompletionSuite:
9999
"""|identity: String (implicit)
100100
|""".stripMargin, // identity2 won't be available
101101
filter = _.contains("(implicit)")
102-
103102
)
104103

105104
@Test def `filter-by-type-subtype` =

presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionKeywordSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CompletionKeywordSuite extends BaseCompletionSuite:
5757
| **/
5858
|}
5959
|""".stripMargin,
60-
"",
60+
"",
6161
includeCommitCharacter = true
6262
)
6363

presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ class CompletionSuite extends BaseCompletionSuite:
13601360
| val t: TT@@
13611361
|}
13621362
|""".stripMargin,
1363-
"TTT[A <: Int] = List[A]"
1363+
"TTT[A <: Int] = List[A]"
13641364
)
13651365

13661366
@Test def `type-lambda` =

presentation-compiler/test/dotty/tools/pc/tests/hover/HoverDocSuite.scala

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ class HoverDocSuite extends BaseHoverSuite:
1919

2020
@Test def `doc` =
2121
check(
22-
"""object a {
23-
| <<java.util.Collections.empty@@List[Int]>>
24-
|}
25-
|""".stripMargin,
26-
"""|**Expression type**:
27-
|```scala
28-
|java.util.List[Int]
29-
|```
30-
|**Symbol signature**:
31-
|```scala
32-
|final def emptyList[T](): java.util.List[T]
33-
|```
34-
|Found documentation for java/util/Collections#emptyList().
35-
|""".stripMargin,
22+
"""|object a {
23+
| <<java.util.Collections.empty@@List[Int]>>
24+
|}
25+
|""".stripMargin,
26+
"""|**Expression type**:
27+
|```scala
28+
|java.util.List[Int]
29+
|```
30+
|**Symbol signature**:
31+
|```scala
32+
|final def emptyList[T](): java.util.List[T]
33+
|```
34+
|Found documentation for java/util/Collections#emptyList().
35+
|""".stripMargin,
3636
)
3737

3838
@Test def `doc-parent` =
@@ -47,7 +47,6 @@ class HoverDocSuite extends BaseHoverSuite:
4747
|```
4848
|Found documentation for scala/collection/LinearSeqOps#headOption().
4949
|""".stripMargin,
50-
5150
)
5251

5352
@Test def `java-method` =
@@ -61,7 +60,7 @@ class HoverDocSuite extends BaseHoverSuite:
6160
|```
6261
|Found documentation for java/lang/String#substring().
6362
|""".stripMargin
64-
)
63+
)
6564

6665
@Test def `object` =
6766
check(

scaladoc/test/dotty/tools/scaladoc/site/TemplateFileTests.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,26 +208,26 @@ class TemplateFileTests:
208208
testTemplate(
209209
"""# Hello {{ msg }}!""",
210210
ext = "md"
211-
) { t =>
211+
): t =>
212212
assertEquals(
213213
"""<section id="hello-there">
214-
|<h1 class="h500"><a href="#hello-there" class="anchor"></a>Hello there!</h1>
215-
|</section>""".stripMargin,
216-
t.resolveInner(RenderingContext(Map("msg" -> "there"))).code.trim())
217-
}
214+
|<h1 class="h500"><a href="#hello-there" class="anchor"></a>Hello there!</h1>
215+
|</section>""".stripMargin,
216+
t.resolveInner(RenderingContext(Map("msg" -> "there"))).code.trim()
217+
)
218218

219219
@Test
220220
def mixedTemplates() : Unit =
221221
testTemplate(
222222
"""# Hello {{ msg }}!""",
223223
ext = "md"
224-
) { t =>
224+
): t =>
225225
assertEquals(
226226
"""<section id="hello-there2">
227-
|<h1 class="h500"><a href="#hello-there2" class="anchor"></a>Hello there2!</h1>
228-
|</section>""".stripMargin,
229-
t.resolveInner(RenderingContext(Map("msg" -> "there2"))).code.trim())
230-
}
227+
|<h1 class="h500"><a href="#hello-there2" class="anchor"></a>Hello there2!</h1>
228+
|</section>""".stripMargin,
229+
t.resolveInner(RenderingContext(Map("msg" -> "there2"))).code.trim()
230+
)
231231

232232
@Test
233233
def htmlOnly(): Unit =

tests/neg/i22527.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ def g: Unit =
2323
class X extends AnyRef, Serializable // error
2424
27 // error
2525
)
26+
27+
def onlyIf(x: Int): Unit =
28+
callme(
29+
if (x > 0)
30+
true, "fail") // error syntax is broken after old-style conditional

tests/pos/i22527.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def orElse(x: Int): Unit =
4141
@nowarn("msg=Unit")
4242
def onlyIf(x: Int): Unit =
4343
callme(
44-
if (x > 0)
44+
if (x > 0) then // then syntax required
4545
true, "fail") // warn value discard
4646

4747
def h(xs: List[Int]) =

tests/warn/i22527.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def orElse(x: Int): Unit =
3636

3737
def onlyIf(x: Int): Unit =
3838
callme(
39-
if (x > 0)
39+
if x > 0 then
4040
true, "fail") // warn value discard
4141

4242
def h(xs: List[Int]) =

0 commit comments

Comments
 (0)