From 8076ea0e815999c3bea6f2c98f0b5b3898efed10 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Tue, 1 Oct 2024 09:44:30 -0700 Subject: [PATCH] CommunitySuite: add Intellij Scala plugin code --- .github/workflows/ci.yml | 2 +- build.sbt | 5 + .../CommunityIntellijScalaSuite.scala | 98 +++++++++++++++++++ 3 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 scalafmt-tests-community/intellij/src/test/scala/org/scalafmt/community/intellij/CommunityIntellijScalaSuite.scala diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90f1dc8ac0..3aecc763d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: matrix: java: [ '11' ] os: [windows-latest, ubuntu-latest] - group: [Scala2, Scala3, Spark, Other] + group: [Scala2, Scala3, Spark, Intellij, Other] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/build.sbt b/build.sbt index fbc0d143b7..b773c646ee 100644 --- a/build.sbt +++ b/build.sbt @@ -255,6 +255,11 @@ lazy val communityTestsSpark = project .in(file("scalafmt-tests-community/spark")).settings(communityTestsSettings) .enablePlugins(BuildInfoPlugin).dependsOn(communityTestsCommon) +lazy val communityTestsIntellij = project + .in(file("scalafmt-tests-community/intellij")) + .settings(communityTestsSettings).enablePlugins(BuildInfoPlugin) + .dependsOn(communityTestsCommon) + lazy val communityTestsOther = project .in(file("scalafmt-tests-community/other")).settings(communityTestsSettings) .enablePlugins(BuildInfoPlugin).dependsOn(communityTestsCommon) diff --git a/scalafmt-tests-community/intellij/src/test/scala/org/scalafmt/community/intellij/CommunityIntellijScalaSuite.scala b/scalafmt-tests-community/intellij/src/test/scala/org/scalafmt/community/intellij/CommunityIntellijScalaSuite.scala new file mode 100644 index 0000000000..2f80f3f141 --- /dev/null +++ b/scalafmt-tests-community/intellij/src/test/scala/org/scalafmt/community/intellij/CommunityIntellijScalaSuite.scala @@ -0,0 +1,98 @@ +package org.scalafmt.community.intellij + +import org.scalafmt.community.common.CommunityRepoSuite +import org.scalafmt.community.common.TestStats + +import scala.meta._ + +abstract class CommunityIntellijScalaSuite(name: String) + extends CommunityRepoSuite( + "https://github.com/JetBrains/intellij-scala.git", + name, + ) + +class CommunityIntellijScala_2024_2_Suite + extends CommunityIntellijScalaSuite("intellij-scala-2024.2") { + + override protected def builds = Seq(getBuild( + "2024.2.28", + dialects.Scala213, + 3469, + excluded = "glob:**/{testdata,testData,resources}/**" :: Nil, + fileOverride = """|{ + | "glob:**/sbt/sbt-impl/workspace-entities/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/structure-view/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/repl/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/tasty-reader/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/package-search-client/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/integration/textAnalysis/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/integration/features-trainer/**" { + | runner.dialect = scala33 + | } + |} + |""".stripMargin, + )) + +} + +class CommunityIntellijScala_2024_3_Suite + extends CommunityIntellijScalaSuite("intellij-scala-2024.3") { + + override protected def builds = Seq(getBuild( + "2024.3.4", + dialects.Scala213, + 3475, + excluded = "glob:**/{testdata,testData,resources}/**" :: Nil, + fileOverride = """|{ + | "glob:**/sbt/sbt-impl/workspace-entities/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/structure-view/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/repl/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/tasty-reader/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/package-search-client/**" { + | runner.dialect = scala33 + | } + | "glob:**/scalac-patches/scalac3-patches/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/integration/textAnalysis/**" { + | runner.dialect = scala33 + | } + | "glob:**/scala/integration/features-trainer/**" { + | runner.dialect = scala33 + | } + |} + |""".stripMargin, + statsPerStyle = Map( + "classic" -> TestStats.Style(expectedStatesVisited = 5134862), + "classicWithAlign" -> TestStats.Style(expectedStatesVisited = 5139218), + "classicWithRewrites" -> TestStats.Style(expectedStatesVisited = 5134172), + "fold" -> TestStats.Style(expectedStatesVisited = 7953034), + "keep" -> TestStats.Style(expectedStatesVisited = 4737913), + "keepWithAlign" -> TestStats.Style(expectedStatesVisited = 4739065), + "keepWithRewrites" -> TestStats.Style(expectedStatesVisited = 4748954), + "keepWithScalaJS" -> TestStats.Style(expectedStatesVisited = 5167360), + "unfold" -> TestStats.Style(expectedStatesVisited = 5611808), + ), + )) + +}