diff --git a/sbt/src/sbt-test/project/session-save/build.check.1 b/sbt/src/sbt-test/project/session-save/build.check.1 new file mode 100755 index 000000000..85beb3faa --- /dev/null +++ b/sbt/src/sbt-test/project/session-save/build.check.1 @@ -0,0 +1,7 @@ +k1 := {error("k1")} + +k2 := { +} + +k2 <<= k1 map identity + diff --git a/sbt/src/sbt-test/project/session-save/build.check.2 b/sbt/src/sbt-test/project/session-save/build.check.2 new file mode 100755 index 000000000..d47b51846 --- /dev/null +++ b/sbt/src/sbt-test/project/session-save/build.check.2 @@ -0,0 +1,7 @@ +k1 := {} + +k2 := { +} + +k2 <<= k1 map identity + diff --git a/sbt/src/sbt-test/project/session-save/test b/sbt/src/sbt-test/project/session-save/test index 9011de364..c552f3a31 100755 --- a/sbt/src/sbt-test/project/session-save/test +++ b/sbt/src/sbt-test/project/session-save/test @@ -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 \ No newline at end of file +> k2 +$ must-mirror build.sbt build.check.3 \ No newline at end of file diff --git a/scripted/base/FileCommands.scala b/scripted/base/FileCommands.scala index 6c9ca1c68..d425911ad 100644 --- a/scripted/base/FileCommands.scala +++ b/scripted/base/FileCommands.scala @@ -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) + "'.") } -} \ No newline at end of file +}