mirror of https://github.com/sbt/sbt.git
Add sbt-houserules, formatting.
This commit is contained in:
parent
d7b4c00999
commit
c0f55127db
|
|
@ -49,8 +49,7 @@ object SettingsUsage {
|
||||||
val mySettings: Seq[Setting[_]] = Seq(
|
val mySettings: Seq[Setting[_]] = Seq(
|
||||||
setting(a3, value(3)),
|
setting(a3, value(3)),
|
||||||
setting(b4, map(a4)(_ * 3)),
|
setting(b4, map(a4)(_ * 3)),
|
||||||
update(a5)(_ + 1)
|
update(a5)(_ + 1))
|
||||||
)
|
|
||||||
|
|
||||||
// "compiles" and applies the settings.
|
// "compiles" and applies the settings.
|
||||||
// This can be split into multiple steps to access intermediate results if desired.
|
// This can be split into multiple steps to access intermediate results if desired.
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,7 @@ object SettingsTest extends Properties("settings") {
|
||||||
List(scoped0, scoped1) <- chk :: scopedKeys sliding 2
|
List(scoped0, scoped1) <- chk :: scopedKeys sliding 2
|
||||||
nextInit = if (scoped0 == chk) chk
|
nextInit = if (scoped0 == chk) chk
|
||||||
else (scoped0 zipWith chk) { (p, _) => p + 1 }
|
else (scoped0 zipWith chk) { (p, _) => p + 1 }
|
||||||
} yield derive(setting(scoped1, nextInit))
|
} yield derive(setting(scoped1, nextInit))).toSeq
|
||||||
).toSeq
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// Note: This causes a cycle refernec error, quite frequently.
|
// Note: This causes a cycle refernec error, quite frequently.
|
||||||
|
|
@ -96,8 +95,7 @@ object SettingsTest extends Properties("settings") {
|
||||||
setting(b, value(6)),
|
setting(b, value(6)),
|
||||||
derive(setting(b, a)),
|
derive(setting(b, a)),
|
||||||
setting(a, value(5)),
|
setting(a, value(5)),
|
||||||
setting(b, value(8))
|
setting(b, value(8)))
|
||||||
)
|
|
||||||
val ev = evaluate(settings)
|
val ev = evaluate(settings)
|
||||||
checkKey(a, Some(5), ev) && checkKey(b, Some(8), ev)
|
checkKey(a, Some(5), ev) && checkKey(b, Some(8), ev)
|
||||||
}
|
}
|
||||||
|
|
@ -106,8 +104,7 @@ object SettingsTest extends Properties("settings") {
|
||||||
setting(a, value(3)),
|
setting(a, value(3)),
|
||||||
setting(b, value(6)),
|
setting(b, value(6)),
|
||||||
derive(setting(b, a)),
|
derive(setting(b, a)),
|
||||||
setting(a, value(5))
|
setting(a, value(5)))
|
||||||
)
|
|
||||||
val ev = evaluate(settings)
|
val ev = evaluate(settings)
|
||||||
checkKey(a, Some(5), ev) && checkKey(b, Some(5), ev)
|
checkKey(a, Some(5), ev) && checkKey(b, Some(5), ev)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ object HistoryCommands {
|
||||||
Nth -> ("Execute the command with index n, as shown by the " + ListFull + " command"),
|
Nth -> ("Execute the command with index n, as shown by the " + ListFull + " command"),
|
||||||
Previous -> "Execute the nth command before this one",
|
Previous -> "Execute the nth command before this one",
|
||||||
StartsWithString -> "Execute the most recent command starting with 'string'",
|
StartsWithString -> "Execute the most recent command starting with 'string'",
|
||||||
ContainsString -> "Execute the most recent command containing 'string'"
|
ContainsString -> "Execute the most recent command containing 'string'")
|
||||||
)
|
|
||||||
def helpString = "History commands:\n " + (descriptions.map { case (c, d) => c + " " + d }).mkString("\n ")
|
def helpString = "History commands:\n " + (descriptions.map { case (c, d) => c + " " + d }).mkString("\n ")
|
||||||
def printHelp(): Unit =
|
def printHelp(): Unit =
|
||||||
println(helpString)
|
println(helpString)
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,7 @@ private[sbt] object TypeString {
|
||||||
val TypeMap = Map(
|
val TypeMap = Map(
|
||||||
"java.io.File" -> "File",
|
"java.io.File" -> "File",
|
||||||
"java.net.URL" -> "URL",
|
"java.net.URL" -> "URL",
|
||||||
"java.net.URI" -> "URI"
|
"java.net.URI" -> "URI")
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Parser that extracts basic structure from the string representation of a type from Manifest.toString.
|
* A Parser that extracts basic structure from the string representation of a type from Manifest.toString.
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@ class ParserWithExamplesTest extends Specification {
|
||||||
"use the delegate parser to remove invalid examples" in new parserWithValidExamples {
|
"use the delegate parser to remove invalid examples" in new parserWithValidExamples {
|
||||||
val validCompletions = Completions(Set(
|
val validCompletions = Completions(Set(
|
||||||
suggestion("blue"),
|
suggestion("blue"),
|
||||||
suggestion("red")
|
suggestion("red")))
|
||||||
))
|
|
||||||
parserWithExamples.completions(0) shouldEqual validCompletions
|
parserWithExamples.completions(0) shouldEqual validCompletions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -26,8 +25,7 @@ class ParserWithExamplesTest extends Specification {
|
||||||
"listing valid completions in a derived parser" should {
|
"listing valid completions in a derived parser" should {
|
||||||
"produce only valid examples that start with the character of the derivation" in new parserWithValidExamples {
|
"produce only valid examples that start with the character of the derivation" in new parserWithValidExamples {
|
||||||
val derivedCompletions = Completions(Set(
|
val derivedCompletions = Completions(Set(
|
||||||
suggestion("lue")
|
suggestion("lue")))
|
||||||
))
|
|
||||||
parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions
|
parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -43,8 +41,7 @@ class ParserWithExamplesTest extends Specification {
|
||||||
"produce only examples that start with the character of the derivation" in new parserWithAllExamples {
|
"produce only examples that start with the character of the derivation" in new parserWithAllExamples {
|
||||||
val derivedCompletions = Completions(Set(
|
val derivedCompletions = Completions(Set(
|
||||||
suggestion("lue"),
|
suggestion("lue"),
|
||||||
suggestion("lock")
|
suggestion("lock")))
|
||||||
))
|
|
||||||
parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions
|
parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -56,8 +53,8 @@ class ParserWithExamplesTest extends Specification {
|
||||||
class parserWithAllExamples extends parser(removeInvalidExamples = false)
|
class parserWithAllExamples extends parser(removeInvalidExamples = false)
|
||||||
|
|
||||||
case class parser(examples: Iterable[String] = Set("blue", "yellow", "greeen", "block", "red"),
|
case class parser(examples: Iterable[String] = Set("blue", "yellow", "greeen", "block", "red"),
|
||||||
maxNumberOfExamples: Int = 25,
|
maxNumberOfExamples: Int = 25,
|
||||||
removeInvalidExamples: Boolean) extends Scope {
|
removeInvalidExamples: Boolean) extends Scope {
|
||||||
|
|
||||||
import DefaultParsers._
|
import DefaultParsers._
|
||||||
|
|
||||||
|
|
@ -66,8 +63,7 @@ class ParserWithExamplesTest extends Specification {
|
||||||
colorParser,
|
colorParser,
|
||||||
FixedSetExamples(examples),
|
FixedSetExamples(examples),
|
||||||
maxNumberOfExamples,
|
maxNumberOfExamples,
|
||||||
removeInvalidExamples
|
removeInvalidExamples)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case class GrowableSourceOfExamples() extends Iterable[String] {
|
case class GrowableSourceOfExamples() extends Iterable[String] {
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,7 @@ object Logic {
|
||||||
checkAcyclic(clauses)
|
checkAcyclic(clauses)
|
||||||
|
|
||||||
problem.toLeft(
|
problem.toLeft(
|
||||||
reduce0(clauses, initialFacts, Matched.empty)
|
reduce0(clauses, initialFacts, Matched.empty))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,7 @@ object LogicTest extends Properties("Logic") {
|
||||||
case Right(res) => false
|
case Right(res) => false
|
||||||
case Left(err: Logic.CyclicNegation) => true
|
case Left(err: Logic.CyclicNegation) => true
|
||||||
case Left(err) => sys.error(s"Expected cyclic error, got: $err")
|
case Left(err) => sys.error(s"Expected cyclic error, got: $err")
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
def expect(result: Either[LogicException, Matched], expected: Set[Atom]) = result match {
|
def expect(result: Either[LogicException, Matched], expected: Set[Atom]) = result match {
|
||||||
case Left(err) => false
|
case Left(err) => false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue