Add overwrite validation to the test.

This commit is contained in:
Eugene Vigdorchik 2012-02-27 19:24:10 +04:00
parent e747b7b378
commit cca5b7e2f7
4 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,7 @@
k1 := {error("k1")}
k2 := {
}
k2 <<= k1 map identity

View File

@ -0,0 +1,7 @@
k1 := {}
k2 := {
}
k2 <<= k1 map identity

View File

@ -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

View File

@ -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) + "'.")
}
}
}