Skip to content

Commit 226383b

Browse files
committed
Test that ensure ignored file is not read
1 parent 50de9b2 commit 226383b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

modules/core/src/test/scala/org/scalasteward/core/edit/EditAlgTest.scala

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,17 @@ class EditAlgTest extends FunSuite {
7777
|align.openParenCallSite = false
7878
|""".stripMargin
7979
val buildSbt = repoDir / "build.sbt"
80+
val target = repoDir / "target"
81+
// this file should not be read because it's under target which is git ignored
82+
val targetScalaFile = target / "SomeFile.scala"
8083

8184
val state = MockState.empty
82-
.addFiles(scalafmtConf -> scalafmtConfContent, buildSbt -> "", gitignore -> "")
85+
.addFiles(
86+
scalafmtConf -> scalafmtConfContent,
87+
buildSbt -> "",
88+
gitignore -> "target/",
89+
targetScalaFile -> ""
90+
)
8391
.flatMap(editAlg.applyUpdate(data, update).runS)
8492
.unsafeRunSync()
8593

@@ -92,13 +100,17 @@ class EditAlgTest extends FunSuite {
92100
Cmd("read", scalafmtConf.pathAsString),
93101
Cmd("test", "-f", buildSbt.pathAsString),
94102
Cmd("read", buildSbt.pathAsString),
103+
Cmd("test", "-f", target.pathAsString),
104+
Cmd("test", "-f", targetScalaFile.pathAsString),
95105
Cmd("read", gitignore.pathAsString),
96106
Cmd("test", "-f", repoDir.pathAsString),
97107
Cmd("test", "-f", gitignore.pathAsString),
98108
Cmd("test", "-f", scalafmtConf.pathAsString),
99109
Cmd("read", scalafmtConf.pathAsString),
100110
Cmd("test", "-f", buildSbt.pathAsString),
101111
Cmd("read", buildSbt.pathAsString),
112+
Cmd("test", "-f", target.pathAsString),
113+
Cmd("test", "-f", targetScalaFile.pathAsString),
102114
Cmd("read", scalafmtConf.pathAsString),
103115
Cmd("write", scalafmtConf.pathAsString),
104116
Cmd(
@@ -120,7 +132,8 @@ class EditAlgTest extends FunSuite {
120132
|align.openParenCallSite = false
121133
|""".stripMargin,
122134
buildSbt -> "",
123-
gitignore -> ""
135+
gitignore -> "target/",
136+
targetScalaFile -> ""
124137
)
125138
)
126139

0 commit comments

Comments
 (0)