Exemple #1
0
 @Test
 public void testHelpOption() throws Exception {
   try (CapturingStdOut out = new CapturingStdOut()) {
     Assert.assertEquals(CeylonTool.SC_OK, tool.bootstrap(args("--help")));
     Assert.assertEquals(getHelpOutput(""), out.getOut());
   }
   Assert.assertEquals("help", tool.getToolName());
 }
Exemple #2
0
 @Test
 public void testExample() throws Exception {
   try (CapturingStdOut out = new CapturingStdOut()) {
     Assert.assertEquals(CeylonTool.SC_OK, tool.bootstrap(args("example")));
     Assert.assertTrue(out.getErr(), out.getErr().isEmpty());
     Assert.assertTrue(out.getOut(), out.getOut().isEmpty());
   }
   Assert.assertEquals("example", tool.getToolName());
 }
Exemple #3
0
 @Test
 public void testVersionOption() throws Exception {
   try (CapturingStdOut out = new CapturingStdOut()) {
     Assert.assertEquals(CeylonTool.SC_OK, tool.bootstrap(args("--version")));
     Assert.assertTrue(out.getOut(), out.getOut().startsWith("ceylon version "));
     Assert.assertTrue(out.getErr().isEmpty());
   }
   Assert.assertEquals(null, tool.getToolName());
 }
Exemple #4
0
 @Test
 public void testHelpVersionOption() throws Exception {
   // We expect NO_SUCH_TOOL in this case because the HelpTool
   // isn't loadable by the toolLoader we're using
   try (CapturingStdOut out = new CapturingStdOut()) {
     Assert.assertEquals(CeylonTool.SC_ARGS, tool.bootstrap(args("help", "--version")));
     Assert.assertTrue(out.getOut().isEmpty());
     Assert.assertTrue(
         out.getErr(), out.getErr().contains("ceylon help: Unrecognised long option '--version'"));
   }
   Assert.assertEquals("help", tool.getToolName());
 }