-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for passing java properties into scala-cli from .scala-jv…
…mopts
- Loading branch information
Showing
5 changed files
with
73 additions
and
5 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
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
35 changes: 35 additions & 0 deletions
35
modules/cli/src/test/scala/cli/tests/SetupScalaCLITests.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,35 @@ | ||
package cli.tests | ||
|
||
import com.eed3si9n.expecty.Expecty.expect | ||
|
||
import java.util.Properties | ||
|
||
import scala.build.internal.Constants | ||
import scala.build.tests.TestInputs | ||
import scala.cli.ScalaCli | ||
import scala.util.Properties | ||
|
||
class SetupScalaCLITests extends munit.FunSuite { | ||
|
||
test(s"should read java properties from file") { | ||
val key = "scala-cli" | ||
val value = "true" | ||
val inputs = TestInputs( | ||
os.rel / Constants.jvmPropertiesFileName -> | ||
s"""-Xmx2048m | ||
|-Xms128m | ||
|-Xss8m | ||
|-D$key=$value | ||
|""".stripMargin | ||
) | ||
inputs.fromRoot(root => | ||
// save current props to restore them after test | ||
val currentProps = System.getProperties.clone().asInstanceOf[Properties] | ||
ScalaCli.loadJavaProperties(root) | ||
expect(sys.props.get(key).contains(value)) | ||
|
||
// restore original props | ||
System.setProperties(currentProps) | ||
) | ||
} | ||
} |
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
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