-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add scripted tests for opt-in base directory sources
- Loading branch information
Showing
12 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
15 changes: 15 additions & 0 deletions
15
src/sbt-test/sbt-scalariform/build-prefs-with-base-directory-sources/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import scalariform.formatter.preferences._ | ||
import com.typesafe.sbt.SbtScalariform.ScalariformKeys | ||
|
||
name := "test" | ||
version := "0.1" | ||
|
||
scalariformWithBaseDirectory := true | ||
|
||
ScalariformKeys.preferences := ScalariformKeys.preferences.value | ||
.setPreference(AlignArguments, true) | ||
.setPreference(AlignSingleLineCaseStatements, true) | ||
.setPreference(AlignSingleLineCaseStatements.MaxArrowIndent, 20) | ||
.setPreference(CompactControlReadability, true) | ||
.setPreference(DanglingCloseParenthesis, Force) | ||
.setPreference(SpacesAroundMultiImports, false) |
13 changes: 13 additions & 0 deletions
13
src/sbt-test/sbt-scalariform/build-prefs-with-base-directory-sources/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
sys.props.get("sbt-assembly.version") match { | ||
case Some(x) => addSbtPlugin("com.eed3si9n" % "sbt-assembly" % x) | ||
case _ => sys.error( | ||
"'sbt-assembly.version' property not defined! (add it to scriptedLaunchOpts -D)" | ||
) | ||
} | ||
|
||
sys.props.get("sbt-scalariform.version") match { | ||
case Some(x) => addSbtPlugin("org.scalariform" % "sbt-scalariform" % x) | ||
case _ => sys.error( | ||
"'sbt-scalariform.version' property not defined! (add it to scriptedLaunchOpts -D)" | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
src/sbt-test/sbt-scalariform/build-prefs-with-base-directory-sources/sample/formatted.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
object Foo { | ||
def method( | ||
string: String, | ||
int: Int | ||
) = { | ||
string match { | ||
case "wibble" => 42 | ||
case "foo" => 123 | ||
case _ => 100 | ||
} | ||
} | ||
method( | ||
string = "hello", | ||
int = 1 | ||
) | ||
} |
14 changes: 14 additions & 0 deletions
14
...sbt-test/sbt-scalariform/build-prefs-with-base-directory-sources/sample/unformatted.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
object Foo { | ||
def method( | ||
string: String, | ||
int: Int) = { | ||
string match { | ||
case "wibble" => 42 | ||
case "foo" => 123 | ||
case _ => 100 | ||
} | ||
} | ||
method( | ||
string = "hello", | ||
int = 1) | ||
} |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/sbt-scalariform/build-prefs-with-base-directory-sources/test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$ copy-file sample/unformatted.scala target/A.scala | ||
|
||
-$ must-mirror sample/formatted.scala target/A.scala | ||
|
||
# autoformat on compile | ||
> compile | ||
$ must-mirror sample/formatted.scala target/A.scala |
29 changes: 29 additions & 0 deletions
29
src/sbt-test/sbt-scalariform/file-prefs-with-base-directory-sources/.scalariform.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
withBaseDirectory=true | ||
alignArguments=true | ||
#alignParameters=false | ||
alignSingleLineCaseStatements=true | ||
alignSingleLineCaseStatements.maxArrowIndent=20 | ||
compactControlReadability=true | ||
#compactStringConcatenation=false | ||
danglingCloseParenthesis=Force | ||
#doubleIndentClassDeclaration=false | ||
#doubleIndentConstructorArguments=false | ||
#doubleIndentMethodDeclaration=false | ||
#firstArgumentOnNewline=Force | ||
#firstParameterOnNewline=Force | ||
#formatXml=true | ||
#indentLocalDefs=false | ||
#indentPackageBlocks=true | ||
#indentSpaces=2 | ||
#indentWithTabs=false | ||
#multilineScaladocCommentsStartOnFirstLine=false | ||
#newlineAtEndOfFile=false | ||
#placeScaladocAsterisksBeneathSecondAsterisk=false | ||
#preserveSpaceBeforeArguments=false | ||
#rewriteArrowSymbols=false | ||
#spaceBeforeColon=false | ||
#spaceBeforeContextColon=false | ||
#spaceInsideBrackets=false | ||
#spaceInsideParentheses=false | ||
spacesAroundMultiImports=false | ||
#spacesWithinPatternBinders=true |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-scalariform/file-prefs-with-base-directory-sources/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name := "test" | ||
version := "0.1" |
13 changes: 13 additions & 0 deletions
13
src/sbt-test/sbt-scalariform/file-prefs-with-base-directory-sources/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
sys.props.get("sbt-assembly.version") match { | ||
case Some(x) => addSbtPlugin("com.eed3si9n" % "sbt-assembly" % x) | ||
case _ => sys.error( | ||
"'sbt-assembly.version' property not defined! (add it to scriptedLaunchOpts -D)" | ||
) | ||
} | ||
|
||
sys.props.get("sbt-scalariform.version") match { | ||
case Some(x) => addSbtPlugin("org.scalariform" % "sbt-scalariform" % x) | ||
case _ => sys.error( | ||
"'sbt-scalariform.version' property not defined! (add it to scriptedLaunchOpts -D)" | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
src/sbt-test/sbt-scalariform/file-prefs-with-base-directory-sources/sample/formatted.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
object Foo { | ||
def method( | ||
string: String, | ||
int: Int | ||
) = { | ||
string match { | ||
case "wibble" => 42 | ||
case "foo" => 123 | ||
case _ => 100 | ||
} | ||
} | ||
method( | ||
string = "hello", | ||
int = 1 | ||
) | ||
} |
14 changes: 14 additions & 0 deletions
14
src/sbt-test/sbt-scalariform/file-prefs-with-base-directory-sources/sample/unformatted.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
object Foo { | ||
def method( | ||
string: String, | ||
int: Int) = { | ||
string match { | ||
case "wibble" => 42 | ||
case "foo" => 123 | ||
case _ => 100 | ||
} | ||
} | ||
method( | ||
string = "hello", | ||
int = 1) | ||
} |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/sbt-scalariform/file-prefs-with-base-directory-sources/test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$ copy-file sample/unformatted.scala target/A.scala | ||
|
||
-$ must-mirror sample/formatted.scala target/A.scala | ||
|
||
# autoformat on compile | ||
> compile | ||
$ must-mirror sample/formatted.scala target/A.scala |