Skip to content

Commit

Permalink
add scripted tests for opt-in base directory sources
Browse files Browse the repository at this point in the history
  • Loading branch information
godenji committed Oct 12, 2017
1 parent 36e529b commit 4a64a06
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 0 deletions.
Empty file.
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)
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)"
)
}
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
)
}
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)
}
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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name := "test"
version := "0.1"
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)"
)
}
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
)
}
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)
}
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

0 comments on commit 4a64a06

Please sign in to comment.