-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor launcher option handling in tests
- Loading branch information
1 parent
ed53da5
commit 39d7ea5
Showing
5 changed files
with
40 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
modules/cli-tests/src/main/scala/coursier/clitests/LauncherOptions.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package coursier.clitests | ||
|
||
trait LauncherOptions { | ||
def acceptsDOptions: Boolean | ||
def acceptsJOptions: Boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 1 addition & 21 deletions
22
modules/cli-tests/src/test/scala/coursier/clitests/PackBootstrapTests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
modules/cli-tests/src/test/scala/coursier/clitests/PackLauncherOptions.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package coursier.clitests | ||
|
||
import java.util.Locale | ||
|
||
import scala.util.Properties | ||
|
||
trait PackLauncherOptions extends LauncherOptions { | ||
override lazy val acceptsDOptions = | ||
sys.props.get("coursier-test-launcher-accepts-D").map(_.toLowerCase(Locale.ROOT)) match { | ||
case Some("true") => true | ||
case Some("false") => false | ||
case None => true | ||
case Some(other) => | ||
System.err.println(s"Warning: unrecognized coursier-test-launcher-accepts-D value '$other'") | ||
true | ||
} | ||
override lazy val acceptsJOptions = | ||
sys.props.get("coursier-test-launcher-accepts-J").map(_.toLowerCase(Locale.ROOT)) match { | ||
case Some("true") => true | ||
case Some("false") => false | ||
case None => !Properties.isWin | ||
case Some(other) => | ||
System.err.println(s"Warning: unrecognized coursier-test-launcher-accepts-J value '$other'") | ||
true | ||
} | ||
} |