Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6570fb2

Browse files
minor refactoring of SIP67Tests
1 parent 56f11c2 commit 6570fb2

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

‎compiler/test/dotty/tools/dotc/typer/SIP67Tests.scala‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,38 @@ import org.junit.Assert.fail
88

99
class SIP67Tests extends DottyTest:
1010

11-
@Test
12-
def sip67test1: Unit =
13-
val source = """
14-
import scala.language.strictEquality
15-
import scala.language.experimental.strictEqualityPatternMatching
16-
enum Foo:
17-
case Bar
18-
19-
val _ =
20-
(??? : Foo) match
21-
case Foo.Bar =>
22-
"""
23-
val ctx = checkCompile("typer", source)((_, ctx) => ())
24-
11+
private def checkNoErrors(source: String): Unit =
12+
val ctx = checkCompile("typer", source)((_, _) => ())
2513
if ctx.reporter.hasErrors then
2614
fail("Unexpected compilation errors were reported")
27-
15+
16+
@Test
17+
def sip67test1: Unit =
18+
checkNoErrors:
19+
"""
20+
import scala.language.strictEquality
21+
import scala.language.experimental.strictEqualityPatternMatching
22+
enum Foo:
23+
case Bar
24+
25+
val _ =
26+
(??? : Foo) match
27+
case Foo.Bar =>
28+
"""
2829
@Test
2930
def sip67test2: Unit =
30-
val source = """
31-
import scala.language.strictEquality
32-
import scala.language.experimental.strictEqualityPatternMatching
31+
checkNoErrors:
32+
"""
33+
import scala.language.strictEquality
34+
import scala.language.experimental.strictEqualityPatternMatching
3335
34-
sealed trait Foo
36+
sealed trait Foo
3537
36-
object Foo:
37-
case object Bar extends Foo
38+
object Foo:
39+
case object Bar extends Foo
3840
39-
val _ =
40-
(??? : Foo) match
41-
case Foo.Bar =>
42-
"""
43-
val ctx = checkCompile("typer", source)((_, ctx) => ())
44-
if ctx.reporter.hasErrors then
45-
fail("Unexpected compilation errors were reported")
41+
val _ =
42+
(??? : Foo) match
43+
case Foo.Bar =>
44+
"""
45+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /