Skip to content

Commit

Permalink
Add tests for a multi-source project
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Meltzer authored and kitbellew committed Dec 25, 2021
1 parent 437c0dd commit 62e55f1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugin/src/sbt-test/scalafmt-sbt/sbt/.scalafmt19.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version = 2.0.0
style = IntelliJ
maxColumn = 42
project.git = true
7 changes: 7 additions & 0 deletions plugin/src/sbt-test/scalafmt-sbt/sbt/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ lazy val p18 = project.settings(
scalafmtConfig := file(".scalafmt18.conf"),
scalaVersion := "2.12.1"
)
lazy val p19 = project
.in(file("p19/jvm"))
.settings(
scalafmtConfig := file(".scalafmt19.conf"),
Compile / unmanagedSourceDirectories += baseDirectory.value / "../shared/src",
scalaVersion := "2.12.1"
)

def assertContentsEqual(file: File, expected: String): Unit = {
val obtained =
Expand Down
9 changes: 9 additions & 0 deletions plugin/src/sbt-test/scalafmt-sbt/sbt/test
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ $ copy-file changes/invalid.scala p18/src/main/scala/TestInvalid2.scala
> set p18/scalafmtFailOnErrors := false
> p18/scalafmt

# set up git
$ exec git init -b main p19
$ copy-file changes/good.scala p19/jvm/src/main/scala/TestGood.scala
$ exec git -C p19 add "jvm/src/main/scala/TestGood.scala"
> p19/scalafmtCheck
$ copy-file changes/invalid.scala p19/shared/src/main/scala/TestInvalid1.scala
$ exec git -C p19 add "shared/src/main/scala/TestInvalid1.scala"
> p19/scalafmtCheck

$ copy-file changes/target/managed.scala project/target/managed.scala
$ copy-file changes/x/Something.scala project/x/Something.scala
> scalafmtSbt
Expand Down

0 comments on commit 62e55f1

Please sign in to comment.