Skip to content

Commit

Permalink
Merged branch idea243.release into idea243.x
Browse files Browse the repository at this point in the history
  • Loading branch information
builduser committed Nov 25, 2024
2 parents 3c7d15b + 2f68a92 commit 2a43918
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.intellij.testFramework.PsiTestUtil
import org.jetbrains.plugins.scala.compiler.data.IncrementalityType
import org.jetbrains.plugins.scala.compiler.references.ScalaDirtyScopeHolder.ScopedModule
import org.junit.Assert._
import org.junit.Ignore

class DirtyScopeHolderTest_IdeaIncrementality extends DirtyScopeHolderTestBase {
override protected def incrementalityType: IncrementalityType = IncrementalityType.IDEA
Expand Down Expand Up @@ -87,7 +86,6 @@ abstract class DirtyScopeHolderTestBase extends ScalaCompilerReferenceServiceFix
assertEmptyScopes(dirtyScopes)
}

@Ignore
def testModulePathRename(): Unit = {
myFixture.addFileToProject("A/Foo.scala", "trait Foo")
buildProject()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.jetbrains.plugins.scala.injection

abstract class InjectionInBodyTestBase extends ScalaLanguageInjectionTestBase {

protected val Quotes: String = "\"\"\""
protected lazy val LanguageAnnotationDef: String = scalaInjectionTestFixture.LanguageAnnotationDef

protected def doTestInBody(languageId: String, classBody: String, injectedFileExpectedText: String): Unit = {
val classBodyWithIndent = classBody.replaceAll("\n", "\n ")
val text =
s"""class A {
| $classBodyWithIndent
|}
|""".stripMargin
scalaInjectionTestFixture.doTest(languageId, text, injectedFileExpectedText)
}

protected def doAnnotationTestInBody(languageId: String, classBody: String, injectedFileExpectedText: String): Unit = {
val classBodyWithIndent = classBody.replaceAll("\n", "\n ")
val text =
s"""$LanguageAnnotationDef
|class A {
| $classBodyWithIndent
|}
|""".stripMargin
scalaInjectionTestFixture.doTest(languageId, text, injectedFileExpectedText)
}

protected def doAnnotationTest(languageId: String, text: String, injectedFileExpectedText: String): Unit = {
val textFinal =
s"""$LanguageAnnotationDef
|$text
|""".stripMargin
scalaInjectionTestFixture.doTest(languageId, textFinal, injectedFileExpectedText)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.jetbrains.plugins.scala.injection

import org.jetbrains.plugins.scala.extensions.StringExt
import org.jetbrains.plugins.scala.injection.ScalaInjectionTestFixture.{ExpectedInjection, ShredInfo}

abstract class InjectionViaCommentTestBase extends ScalaLanguageInjectionTestBase {
protected def doInjectedViaCommentTest(
languageId: String,
text: String,
expectedText: String,
expectedShreds: Seq[ShredInfo] = null
): Unit = {
val textWithComment =
s"""//language=$languageId
|$text
|""".stripMargin.replace("'''", "\"\"\"")
val expectedInjection = ExpectedInjection(
expectedText.withNormalizedSeparator,
languageId,
Option(expectedShreds)
)
scalaInjectionTestFixture.doTest(textWithComment, expectedInjection)
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
package org.jetbrains.plugins.scala.injection

import org.jetbrains.plugins.scala.extensions.StringExt
import org.jetbrains.plugins.scala.injection.InjectionTestUtils.RegexpLangId
import org.jetbrains.plugins.scala.injection.ScalaInjectionTestFixture.{ExpectedInjection, ShredInfo}
import org.jetbrains.plugins.scala.injection.ScalaInjectionTestFixture.ShredInfo
import org.jetbrains.plugins.scala.util.TextRangeUtils.ImplicitConversions.tupleToTextRange

class InterpolatedStringWithInjectionsMultilineTest extends ScalaLanguageInjectionTestBase {

private def doInjectedViaCommentTest(
languageId: String,
text: String,
expectedText: String,
expectedShreds: Seq[ShredInfo] = null
): Unit = {
val textWithComment =
s"""//language=$languageId
|$text
|""".stripMargin.replace("'''", "\"\"\"")
val expectedInjection = ExpectedInjection(
expectedText.withNormalizedSeparator,
languageId,
Option(expectedShreds)
)
scalaInjectionTestFixture.doTest(textWithComment, expectedInjection)
}

class InterpolatedStringWithInjectionsMultilineTest extends InjectionViaCommentTestBase {
def testRawInterpolatorWithEscapeSequences(): Unit = {
doInjectedViaCommentTest(
RegexpLangId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,13 @@
package org.jetbrains.plugins.scala.injection

import com.intellij.openapi.module.Module
import com.intellij.patterns.compiler.PatternCompilerImpl.LazyPresentablePattern
import org.intellij.plugins.intelliLang.inject.config.{BaseInjection, InjectionPlace}
import org.jetbrains.plugins.scala.injection.InjectionTestUtils._
import org.jetbrains.plugins.scala.settings.ScalaProjectSettings
import org.junit.Assert._

import scala.jdk.CollectionConverters._

class ScalaLanguageInjectorTest extends ScalaLanguageInjectionTestBase {

private val Quotes = "\"\"\""
private lazy val LanguageAnnotationDef = scalaInjectionTestFixture.LanguageAnnotationDef

override def setUpLibraries(implicit module: Module): Unit = {
super.setUpLibraries

val settings = ScalaProjectSettings.getInstance(module.getProject)
val interpolatorToLangId = Map("json" -> JsonLangId).asJava
settings.setIntInjectionMapping(interpolatorToLangId)
settings.setDisableLangInjection(false)
}

protected def doTestInBody(languageId: String, classBody: String, injectedFileExpectedText: String): Unit = {
val classBodyWithIndent = classBody.replaceAll("\n", "\n ")
val text =
s"""class A {
| $classBodyWithIndent
|}
|""".stripMargin
scalaInjectionTestFixture.doTest(languageId, text, injectedFileExpectedText)
}

protected def doAnnotationTestInBody(languageId: String, classBody: String, injectedFileExpectedText: String): Unit = {
val classBodyWithIndent = classBody.replaceAll("\n", "\n ")
val text =
s"""$LanguageAnnotationDef
|class A {
| $classBodyWithIndent
|}
|""".stripMargin
scalaInjectionTestFixture.doTest(languageId, text, injectedFileExpectedText)
}

protected def doAnnotationTest(languageId: String, text: String, injectedFileExpectedText: String): Unit = {
val textFinal =
s"""$LanguageAnnotationDef
|$text
|""".stripMargin
scalaInjectionTestFixture.doTest(languageId, textFinal, injectedFileExpectedText)
}
class ScalaLanguageInjectorTest extends InjectionInBodyTestBase {

////////////////////////////////////////
// @Language annotation injection tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ class MethodCallChainsTest extends AbstractScalaFormatterTestBase {
doTextTest(before, after)
}

@Ignore("waiting for https://youtrack.jetbrains.com/issue/SCL-15163")
def ignore_MethodCallChain_Align_DoNotWrap_FirstNewLineCallIsMultiline(): Unit = {
def testIgnore_MethodCallChain_Align_DoNotWrap_FirstNewLineCallIsMultiline(): Unit = {
getCommonSettings.ALIGN_MULTILINE_CHAINED_METHODS = true
getCommonSettings.METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP
setupRightMargin(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jetbrains.plugins.scala.lang.resolve2
import org.jetbrains.plugins.scala.ScalaVersion
import org.junit.Ignore

class Bug3Test_2_11 extends Bug3TestBase {
override protected def supportedIn(version: ScalaVersion): Boolean = version == ScalaVersion.Latest.Scala_2_11
Expand All @@ -11,7 +10,7 @@ class Bug3Test_2_12 extends Bug3TestBase {
class Bug3Test_2_13 extends Bug3TestBase {
override protected def supportedIn(version: ScalaVersion): Boolean = version == ScalaVersion.Latest.Scala_2_13

@Ignore // canBuildFrom is not available in 2.13
// canBuildFrom is not available in 2.13
override def testSCL7142(): Unit = ()

// new deprecatedName constructor
Expand Down

0 comments on commit 2a43918

Please sign in to comment.