Skip to content

Commit be99ba6

Browse files
committed
Abstract over testOnly task
1 parent 1bf0f98 commit be99ba6

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

project/Build.scala

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -577,23 +577,8 @@ object Build {
577577
jarOpts ::: tuning ::: agentOptions ::: ci_build ::: path.toList
578578
},
579579

580-
testCompilation := Def.inputTaskDyn {
581-
val args: Seq[String] = spaceDelimited("<arg>").parsed
582-
val cmd = " dotty.tools.dotc.CompilationTests -- --exclude-categories=dotty.SlowTests" + {
583-
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
584-
else ""
585-
}
586-
(testOnly in Test).toTask(cmd)
587-
}.evaluated,
588-
589-
testFromTasty := Def.inputTaskDyn {
590-
val args: Seq[String] = spaceDelimited("<arg>").parsed
591-
val cmd = " dotty.tools.dotc.FromTastyTests -- " + {
592-
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
593-
else ""
594-
}
595-
(testOnly in Test).toTask(cmd)
596-
}.evaluated,
580+
testCompilation := testOnly("dotty.tools.dotc.CompilationTests", "--exclude-categories=dotty.SlowTests").evaluated,
581+
testFromTasty := testOnly("dotty.tools.dotc.FromTastyTests", "").evaluated,
597582

598583
dotr := {
599584
val args: List[String] = spaceDelimited("<arg>").parsed.toList
@@ -1249,4 +1234,13 @@ object Build {
12491234
case BootstrappedOptimised => commonOptimisedSettings
12501235
})
12511236
}
1237+
1238+
def testOnly(test: String, options: String) = Def.inputTaskDyn {
1239+
val args = spaceDelimited("<arg>").parsed
1240+
val cmd = s" $test -- $options" + {
1241+
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
1242+
else ""
1243+
}
1244+
(testOnly in Test).toTask(cmd)
1245+
}
12521246
}

0 commit comments

Comments
 (0)