Skip to content

Commit c1c9bbb

Browse files
committed
CommunitySuite: add Intellij Scala plugin code
1 parent 885eb5d commit c1c9bbb

File tree

4 files changed

+106
-3
lines changed

4 files changed

+106
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
matrix:
6767
java: [ '11' ]
6868
os: [windows-latest, ubuntu-latest]
69-
group: [Scala2, Scala3, Spark, Other]
69+
group: [Scala2, Scala3, Spark, Intellij, Other]
7070
runs-on: ${{ matrix.os }}
7171
steps:
7272
- uses: actions/checkout@v4

build.sbt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ lazy val communityTestsSpark = project
255255
.in(file("scalafmt-tests-community/spark")).settings(communityTestsSettings)
256256
.enablePlugins(BuildInfoPlugin).dependsOn(communityTestsCommon)
257257

258+
lazy val communityTestsIntellij = project
259+
.in(file("scalafmt-tests-community/intellij"))
260+
.settings(communityTestsSettings).enablePlugins(BuildInfoPlugin)
261+
.dependsOn(communityTestsCommon)
262+
258263
lazy val communityTestsOther = project
259264
.in(file("scalafmt-tests-community/other")).settings(communityTestsSettings)
260265
.enablePlugins(BuildInfoPlugin).dependsOn(communityTestsCommon)

scalafmt-tests-community/common/src/main/scala/org/scalafmt/community/common/CommunitySuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ abstract class CommunitySuite extends FunSuite {
6464
build.checkedFiles * 2,
6565
s"expected ${stats.checkedFiles / 2} per run",
6666
)
67-
build.statsPerStyle.get(styleName).foreach { styleStats =>
68-
assertEquals(statesVisited, styleStats.expectedStatesVisited)
67+
if (!OsSpecific.isWindows) build.statsPerStyle.get(styleName).foreach { x =>
68+
assertEquals(statesVisited, x.expectedStatesVisited)
6969
}
7070
}
7171

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
package org.scalafmt.community.intellij
2+
3+
import org.scalafmt.community.common.CommunityRepoSuite
4+
import org.scalafmt.community.common.TestStats
5+
6+
import scala.meta._
7+
8+
abstract class CommunityIntellijScalaSuite(name: String)
9+
extends CommunityRepoSuite(
10+
"https://github.com/JetBrains/intellij-scala.git",
11+
name,
12+
)
13+
14+
class CommunityIntellijScala_2024_2_Suite
15+
extends CommunityIntellijScalaSuite("intellij-scala-2024.2") {
16+
17+
override protected def builds = Seq(getBuild(
18+
"2024.2.28",
19+
dialects.Scala213,
20+
3469,
21+
excluded = "glob:**/{testdata,testData,resources}/**" :: Nil,
22+
fileOverride = """|{
23+
| "glob:**/sbt/sbt-impl/workspace-entities/**" {
24+
| runner.dialect = scala33
25+
| }
26+
| "glob:**/scala/structure-view/**" {
27+
| runner.dialect = scala33
28+
| }
29+
| "glob:**/scala/repl/**" {
30+
| runner.dialect = scala33
31+
| }
32+
| "glob:**/scala/tasty-reader/**" {
33+
| runner.dialect = scala33
34+
| }
35+
| "glob:**/scala/package-search-client/**" {
36+
| runner.dialect = scala33
37+
| }
38+
| "glob:**/scala/integration/textAnalysis/**" {
39+
| runner.dialect = scala33
40+
| }
41+
| "glob:**/scala/integration/features-trainer/**" {
42+
| runner.dialect = scala33
43+
| }
44+
|}
45+
|""".stripMargin,
46+
))
47+
48+
}
49+
50+
class CommunityIntellijScala_2024_3_Suite
51+
extends CommunityIntellijScalaSuite("intellij-scala-2024.3") {
52+
53+
override protected def builds = Seq(getBuild(
54+
"2024.3.4",
55+
dialects.Scala213,
56+
3475,
57+
excluded = "glob:**/{testdata,testData,resources}/**" :: Nil,
58+
fileOverride = """|{
59+
| "glob:**/sbt/sbt-impl/workspace-entities/**" {
60+
| runner.dialect = scala33
61+
| }
62+
| "glob:**/scala/structure-view/**" {
63+
| runner.dialect = scala33
64+
| }
65+
| "glob:**/scala/repl/**" {
66+
| runner.dialect = scala33
67+
| }
68+
| "glob:**/scala/tasty-reader/**" {
69+
| runner.dialect = scala33
70+
| }
71+
| "glob:**/scala/package-search-client/**" {
72+
| runner.dialect = scala33
73+
| }
74+
| "glob:**/scalac-patches/scalac3-patches/**" {
75+
| runner.dialect = scala33
76+
| }
77+
| "glob:**/scala/integration/textAnalysis/**" {
78+
| runner.dialect = scala33
79+
| }
80+
| "glob:**/scala/integration/features-trainer/**" {
81+
| runner.dialect = scala33
82+
| }
83+
|}
84+
|""".stripMargin,
85+
statsPerStyle = Map(
86+
"classic" -> TestStats.Style(expectedStatesVisited = 5134862),
87+
"classicWithAlign" -> TestStats.Style(expectedStatesVisited = 5139218),
88+
"classicWithRewrites" -> TestStats.Style(expectedStatesVisited = 5134172),
89+
"fold" -> TestStats.Style(expectedStatesVisited = 7953034),
90+
"keep" -> TestStats.Style(expectedStatesVisited = 4737913),
91+
"keepWithAlign" -> TestStats.Style(expectedStatesVisited = 4739065),
92+
"keepWithRewrites" -> TestStats.Style(expectedStatesVisited = 4748954),
93+
"keepWithScalaJS" -> TestStats.Style(expectedStatesVisited = 5167360),
94+
"unfold" -> TestStats.Style(expectedStatesVisited = 5611808),
95+
),
96+
))
97+
98+
}

0 commit comments

Comments
 (0)