use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ZipFileTreeTest method doesNotOverwriteFilesOnSecondVisit.
@Test
public void doesNotOverwriteFilesOnSecondVisit() throws InterruptedException {
rootDir.file("file1.txt").write("content");
rootDir.zipTo(zipFile);
assertVisits(tree, toList("file1.txt"), new ArrayList<String>());
TestFile content = expandDir.listFiles()[0].listFiles()[0];
content.makeOlder();
TestFile.Snapshot snapshot = content.snapshot();
assertVisits(tree, toList("file1.txt"), new ArrayList<String>());
content.assertHasNotChangedSince(snapshot);
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method buildFailsWhenSpecifiedBuildFileIsNotAFile.
@Test
public void buildFailsWhenSpecifiedBuildFileIsNotAFile() {
TestFile file = testFile("unknown");
ExecutionFailure result = usingBuildFile(file).runWithFailure();
result.assertHasDescription("The specified build file '" + file + "' does not exist.");
file.createDir();
result = usingBuildFile(file).runWithFailure();
result.assertHasDescription("The specified build file '" + file + "' is not a file.");
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method multiProjectBuildCanHaveSettingsFileAndRootBuildFileInSubDir.
@Test
public void multiProjectBuildCanHaveSettingsFileAndRootBuildFileInSubDir() {
TestFile buildFilesDir = getTestDirectory().file("root");
TestFile settingsFile = buildFilesDir.file("settings.gradle");
settingsFile.writelns("includeFlat 'child'", "rootProject.projectDir = new File(settingsDir, '..')", "rootProject.buildFileName = 'root/build.gradle'");
TestFile rootBuildFile = buildFilesDir.file("build.gradle");
rootBuildFile.write("task('do-stuff', dependsOn: ':child:task')");
TestFile childBuildFile = testFile("child/build.gradle");
childBuildFile.writelns("task('do-stuff')", "task('task')");
usingProjectDir(getTestDirectory()).usingSettingsFile(settingsFile).withTasks("do-stuff").run().assertTasksExecuted(":child:task", ":do-stuff", ":child:do-stuff").assertTaskOrder(":child:task", ":do-stuff");
usingBuildFile(rootBuildFile).withTasks("do-stuff").run().assertTasksExecuted(":child:task", ":do-stuff", ":child:do-stuff").assertTaskOrder(":child:task", ":do-stuff");
usingBuildFile(childBuildFile).usingSettingsFile(settingsFile).withTasks("do-stuff").run().assertTasksExecutedInOrder(":child:do-stuff");
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method canDetermineRootProjectAndDefaultProjectBasedOnProjectDirectory.
@Test
public void canDetermineRootProjectAndDefaultProjectBasedOnProjectDirectory() {
File rootDir = getTestDirectory();
File childDir = new File(rootDir, "child");
testFile("settings.gradle").write("include('child')");
testFile("build.gradle").write("task('do-stuff')");
testFile("child/build.gradle").write("task('do-stuff')");
usingProjectDir(rootDir).withTasks("do-stuff").run().assertTasksExecuted(":do-stuff", ":child:do-stuff");
usingProjectDir(rootDir).withTasks(":do-stuff").run().assertTasksExecuted(":do-stuff");
usingProjectDir(childDir).withTasks("do-stuff").run().assertTasksExecuted(":child:do-stuff");
usingProjectDir(childDir).withTasks(":do-stuff").run().assertTasksExecuted(":do-stuff");
}
use of org.gradle.test.fixtures.file.TestFile in project gradle by gradle.
the class ProjectLoadingIntegrationTest method buildFailsWhenSpecifiedSettingsFileIsNotAFile.
@Test
public void buildFailsWhenSpecifiedSettingsFileIsNotAFile() {
TestFile file = testFile("unknown");
ExecutionFailure result = inTestDirectory().usingSettingsFile(file).runWithFailure();
result.assertHasDescription("The specified settings file '" + file + "' does not exist.");
file.createDir();
result = inTestDirectory().usingSettingsFile(file).runWithFailure();
result.assertHasDescription("The specified settings file '" + file + "' is not a file.");
}
Aggregations