use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class MapFileTreeTest method doesNotOverwriteFileWhenGeneratedContentRemainsTheSame.
@Test
public void doesNotOverwriteFileWhenGeneratedContentRemainsTheSame() throws InterruptedException {
Action<OutputStream> action = getAction();
tree.add("path/file.txt", action);
assertVisits(tree, toList("path/file.txt"), toList("path"));
TestFile file = rootDir.file("path/file.txt");
file.assertContents(equalTo("content"));
file.makeOlder();
TestFile.Snapshot snapshot = file.snapshot();
assertVisits(tree, toList("path/file.txt"), toList("path"));
file.assertContents(equalTo("content"));
file.assertHasNotChangedSince(snapshot);
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method canDetermineRootProjectAndDefaultProjectBasedOnBuildFile.
@Test
public void canDetermineRootProjectAndDefaultProjectBasedOnBuildFile() {
testFile("settings.gradle").write("include('child')");
TestFile rootBuildFile = testFile("build.gradle");
rootBuildFile.write("task('do-stuff')");
TestFile childBuildFile = testFile("child/build.gradle");
childBuildFile.write("task('do-stuff')");
usingBuildFile(rootBuildFile).withTasks("do-stuff").run().assertTasksExecuted(":do-stuff", ":child:do-stuff");
usingBuildFile(rootBuildFile).withTasks(":do-stuff").run().assertTasksExecuted(":do-stuff");
usingBuildFile(childBuildFile).withTasks("do-stuff").run().assertTasksExecuted(":child:do-stuff");
usingBuildFile(childBuildFile).withTasks(":do-stuff").run().assertTasksExecuted(":do-stuff");
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method settingsFileInParentDirectoryTakesPrecedenceOverBuildFile.
@Test
public void settingsFileInParentDirectoryTakesPrecedenceOverBuildFile() {
testFile("settings.gradle").writelns("include 'child'", "project(':child').buildFileName = 'child.gradle'");
TestFile subDirectory = getTestDirectory().file("child");
subDirectory.file("build.gradle").write("throw new RuntimeException()");
subDirectory.file("child.gradle").write("task('do-stuff')");
inDirectory(subDirectory).withTasks("do-stuff").run();
usingProjectDir(subDirectory).withTasks("do-stuff").run();
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method noDeprecationWarningAppearsWhenSettingsFileIsSpecified.
@Test
public void noDeprecationWarningAppearsWhenSettingsFileIsSpecified() {
testFile("settings.gradle").write("include 'another'");
TestFile subDirectory = getTestDirectory().file("sub");
TestFile subSettingsFile = subDirectory.file("renamed_settings.gradle").write("");
subDirectory.file("build.gradle").write("");
inDirectory(subDirectory).usingSettingsFile(subSettingsFile).withTasks("help").run();
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method buildFailsWhenSpecifiedProjectDirectoryIsNotADirectory.
@Test
public void buildFailsWhenSpecifiedProjectDirectoryIsNotADirectory() {
TestFile file = testFile("unknown");
ExecutionFailure result = usingProjectDir(file).runWithFailure();
result.assertHasDescription("The specified project directory '" + file + "' does not exist.");
file.createFile();
result = usingProjectDir(file).runWithFailure();
result.assertHasDescription("The specified project directory '" + file + "' is not a directory.");
}
Aggregations