AppContext.RUN.fileSystem = fs;
File taskless = fs.getTemporaryDirectory("taskless", Lifetimes.moeExecution());
Files.touch(taskless);
Task outer = AppContext.RUN.ui.pushTask("outer", "outer");
File outer1 = touchTempDir("outer1", fs);
File outer2 = touchTempDir("outer2", fs);
Task inner = AppContext.RUN.ui.pushTask("inner", "inner");
File inner1 = touchTempDir("inner1", fs);
File inner2 = touchTempDir("inner2", fs);
File innerPersist = fs.getTemporaryDirectory("innerPersist", Lifetimes.moeExecution());
Files.touch(innerPersist);
AppContext.RUN.ui.popTask(inner, "popping inner, persisting nothing");
assertFalse("inner1", inner1.exists());
assertFalse("inner2", inner2.exists());
assertTrue("innerPersist", innerPersist.exists());
assertTrue("taskless", taskless.exists());
assertTrue("outer1", outer1.exists());
assertTrue("outer2", outer2.exists());
AppContext.RUN.ui.popTask(outer, "popping outer, persisting nothing");
assertFalse("outer1", outer1.exists());
assertFalse("outer2", outer2.exists());
assertTrue("innerPersist", innerPersist.exists());
assertTrue("taskless", taskless.exists());
Task moeTermination =
AppContext.RUN.ui.pushTask(Ui.MOE_TERMINATION_TASK_NAME, "Final clean-up");
fs.cleanUpTempDirs();
AppContext.RUN.ui.popTask(moeTermination, "Finished clean-up");
assertFalse("innerPersist", innerPersist.exists());
assertFalse("taskless", taskless.exists());