Skip to content

Commit

Permalink
cherry pick 357e026
Browse files Browse the repository at this point in the history
Don't use JAVA_HOME in PropertiesTest
  • Loading branch information
jtjeferreira committed Dec 20, 2024
1 parent 3e98dd0 commit d911336
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/test/dotty/tools/dotc/config/PropertiesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ class PropertiesTest {

var done = false
assertEquals(Properties.propOrElse(TestProperty, { done = true; "bar" }), "foo")
assertTrue("Does not evaluate alt if not needed", done == false)
assertFalse("Does not evaluate alt if not needed", done)
}

@Test
def testEnvOrElse(): Unit = {
assertEquals(Properties.envOrElse("_PropertiesTest_NOT_DEFINED", "test"), "test")

var done = false
assertNotEquals(Properties.envOrElse("JAVA_HOME", { done = true; "bar" }), "bar")
assertTrue("Does not evaluate alt if not needed", done == false)
val envName = System.getenv().keySet().iterator().next()
assertNotEquals(Properties.envOrElse(envName, {done = true; "bar"}), "bar")
assertFalse("Does not evaluate alt if not needed", done)
}
}

0 comments on commit d911336

Please sign in to comment.