public void testGetRakeTask() throws Exception { RubyProject project = createTestProject(); RakeTask task = RakeSupport.getRakeTask(project, "clean"); assertNotNull("clean task found", task); assertEquals("clean task found", "clean", task.getTask()); assertNull("dummy task does not exist", RakeSupport.getRakeTask(project, "dummy")); }
public void testTaskWithNamespace() throws Exception { RubyProject project = createTestProject(); String rakeContent = "namespace 'test' do\n" + " desc 'test coverage'\n" + " task :coverage\n" + "end"; dumpRakefile(rakeContent, project); RakeSupport.refreshTasks(project); RakeTaskReader rakeTaskReader = new RakeTaskReader(project); Set<RakeTask> tasks = rakeTaskReader.getRakeTaskTree(); assertEquals("one task", 1, tasks.size()); RakeTask multi = RakeSupport.getRakeTask(project, "test:coverage"); assertNotNull(multi); assertEquals("semicoloned task", "test:coverage", multi.getTask()); assertEquals("semicoloned task", "coverage", multi.getDisplayName()); }
public void testTaskWithoutComment() throws Exception { RubyProject project = createTestProject(); String rakeContent = "task :no_comment\n" + "\n" + "desc 'task1 task1'\n" + "task :task1"; dumpRakefile(rakeContent, project); RakeSupport.refreshTasks(project); RakeTaskReader rakeTaskReader = new RakeTaskReader(project); Set<RakeTask> tasks = rakeTaskReader.getRakeTaskTree(false); assertEquals("two task", 2, tasks.size()); RakeTask noComment = RakeSupport.getRakeTask(project, "no_comment"); assertNotNull(noComment); assertFalse("is task", noComment.isNameSpace()); assertEquals("no_comment task", "no_comment", noComment.getTask()); assertEquals("no_comment task display name", "no_comment", noComment.getDisplayName()); assertNull("no_comment task description", noComment.getDescription()); }
public void testMultilineDescriptions() throws Exception { RubyProject project = createTestProject(); String rakeContent = "desc 'Dummy task'\n" + "task :dummy\n" + "\n" + "desc 'Multiline\n" + "dummy'\n" + "task :multiline_dummy"; dumpRakefile(rakeContent, project); RakeSupport.refreshTasks(project); RakeTaskReader rakeTaskReader = new RakeTaskReader(project); Set<RakeTask> tasks = rakeTaskReader.getRakeTaskTree(); assertEquals("two tasks", 2, tasks.size()); RakeTask multi = RakeSupport.getRakeTask(project, "multiline_dummy"); assertNotNull(multi); assertEquals("has multiline description", "Multiline\ndummy", multi.getDescription()); }