mirror of https://github.com/sbt/sbt.git
Add overwrite validation to the test.
This commit is contained in:
parent
e747b7b378
commit
cca5b7e2f7
|
|
@ -0,0 +1,7 @@
|
|||
k1 := {error("k1")}
|
||||
|
||||
k2 := {
|
||||
}
|
||||
|
||||
k2 <<= k1 map identity
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
k1 := {}
|
||||
|
||||
k2 := {
|
||||
}
|
||||
|
||||
k2 <<= k1 map identity
|
||||
|
||||
|
|
@ -7,16 +7,19 @@
|
|||
> session save
|
||||
> reload
|
||||
-> k2
|
||||
$ must-mirror build.sbt build.check.1
|
||||
|
||||
> set k1 := {}
|
||||
> session save
|
||||
> reload
|
||||
> k1
|
||||
> k2
|
||||
$ must-mirror build.sbt build.check.2
|
||||
|
||||
> set k1 <<= k1 map {_ => error("k1")}
|
||||
> set k2 := {}
|
||||
> session save
|
||||
> reload
|
||||
-> k1
|
||||
> k2
|
||||
> k2
|
||||
$ must-mirror build.sbt build.check.3
|
||||
|
|
@ -24,6 +24,7 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler
|
|||
"exec" nonEmpty(execute _ ),
|
||||
"copy" copy (to => rebase(baseDirectory, to)),
|
||||
"copy-file" twoArg("Two paths", copyFile _),
|
||||
"must-mirror" twoArg("Two paths", diffFiles _),
|
||||
"copy-flat" copy flat
|
||||
)
|
||||
|
||||
|
|
@ -42,6 +43,12 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler
|
|||
IO.copyFile(fromString(from), fromString(to))
|
||||
def makeDirectories(paths: List[String]) =
|
||||
IO.createDirectories(fromStrings(paths))
|
||||
def diffFiles(file1: String, file2: String) = {
|
||||
val lines1 = IO.readLines(fromString(file1))
|
||||
val lines2 = IO.readLines(fromString(file2))
|
||||
if (lines1 != lines2)
|
||||
scriptError("File contents are different:\n" + lines1.mkString("\n") + "\nAnd:\n" + lines2.mkString("\n"))
|
||||
}
|
||||
|
||||
def newer(a: String, b: String) =
|
||||
{
|
||||
|
|
@ -115,4 +122,4 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler
|
|||
def wrongArguments(requiredArgs: String, args: List[String]): Some[String] =
|
||||
scriptError("Wrong number of arguments to " + commandName + " command. " + requiredArgs + " required, found: '" + spaced(args) + "'.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue