-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport "Add regression test for issue 18726" to LTS (#22125)
Backports #20318 to the 3.3.5. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
5 changed files
with
77 additions
and
2 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
32 changes: 32 additions & 0 deletions
32
presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease11Suite.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,32 @@ | ||
package dotty.tools.pc.tests.completion | ||
|
||
import dotty.tools.pc.base.BaseCompletionSuite | ||
|
||
import org.junit.Test | ||
import org.junit.Before | ||
import java.nio.file.Path | ||
import dotty.tools.pc.utils.JRE | ||
|
||
class CompletionRelease11Suite extends BaseCompletionSuite: | ||
|
||
override protected def scalacOptions(classpath: Seq[Path]): Seq[String] = | ||
"-release:11" +: super.scalacOptions(classpath) | ||
|
||
@Before | ||
def beforeMethod(): Unit = | ||
org.junit.Assume.assumeTrue(JRE.getJavaMajorVersion >= 11) | ||
|
||
@Test def java11Symbols = | ||
check( | ||
""" | ||
|object A { | ||
| "".repea@@ | ||
|}""".stripMargin, | ||
"""repeat(x$0: Int): String | ||
|replaceAll(x$0: String, x$1: String): String | ||
|prependedAll[B >: A](prefix: IterableOnce[B]): IndexedSeq[B] | ||
|prependedAll(prefix: String): String | ||
|prependedAll[B >: Char](prefix: IterableOnce[B]): IndexedSeq[B] | ||
|replaceAllLiterally(literal: String, replacement: String): String | ||
|""".stripMargin | ||
) |
31 changes: 31 additions & 0 deletions
31
presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease8Suite.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,31 @@ | ||
package dotty.tools.pc.tests.completion | ||
|
||
import dotty.tools.pc.base.BaseCompletionSuite | ||
|
||
import org.junit.Test | ||
import org.junit.Before | ||
import java.nio.file.Path | ||
import dotty.tools.pc.utils.JRE | ||
|
||
class CompletionRelease8Suite extends BaseCompletionSuite: | ||
|
||
override protected def scalacOptions(classpath: Seq[Path]): Seq[String] = | ||
"-release:8" +: super.scalacOptions(classpath) | ||
|
||
@Before | ||
def beforeMethod(): Unit = | ||
org.junit.Assume.assumeTrue(JRE.getJavaMajorVersion >= 8) | ||
|
||
@Test def noJvm11Symbols = | ||
check( | ||
""" | ||
|object A { | ||
| "".repea@@ | ||
|}""".stripMargin, | ||
"""replaceAll(x$0: String, x$1: String): String | ||
|prependedAll[B >: A](prefix: IterableOnce[B]): IndexedSeq[B] | ||
|prependedAll(prefix: String): String | ||
|prependedAll[B >: Char](prefix: IterableOnce[B]): IndexedSeq[B] | ||
|replaceAllLiterally(literal: String, replacement: String): String | ||
|""".stripMargin | ||
) |
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,13 @@ | ||
package dotty.tools.pc.utils | ||
|
||
object JRE: | ||
|
||
def getJavaMajorVersion: Int = | ||
val javaVersion = sys.env.get("java.specification.version").filter(!_.isEmpty()) | ||
|
||
javaVersion match | ||
case Some(version) if version.startsWith("1.8") => 8 | ||
case Some(version) => version.toInt // it is better to crash during tests than to run incorrect suite | ||
case None => 8 | ||
|
||
|