Ejemplo n.º 1
0
 @Test
 public void testInvalidLabel() throws Exception {
   try {
     Type.LABEL.convert("not a label", null, currentRule);
     fail();
   } catch (Type.ConversionException e) {
     MoreAsserts.assertContainsWordsWithQuotes(e.getMessage(), "not a label");
   }
 }
Ejemplo n.º 2
0
 public void testExecutableSymlink() throws Exception {
   Executor executor = new TestExecutorBuilder(directories, null).build();
   outputArtifact = getBinArtifactWithNoOwner("destination2.txt");
   output = outputArtifact.getPath();
   action = new ExecutableSymlinkAction(NULL_ACTION_OWNER, inputArtifact, outputArtifact);
   assertFalse(input.isExecutable());
   ActionExecutionContext actionExecutionContext =
       new ActionExecutionContext(executor, null, null, null, null);
   try {
     action.execute(actionExecutionContext);
     fail("Expected ActionExecutionException");
   } catch (ActionExecutionException e) {
     MoreAsserts.assertContainsRegex("'input.txt' is not executable", e.getMessage());
   }
   input.setExecutable(true);
   action.execute(actionExecutionContext);
   assertTrue(output.isSymbolicLink());
   assertEquals(input, output.resolveSymbolicLinks());
 }
 public void testVisitation() throws Exception {
   VisitationRecorder recorder = new VisitationRecorder();
   mapper.visitLabels(recorder);
   MoreAsserts.assertSameContents(
       ImmutableList.of("//x:a", "//x:b", "//x:c"), recorder.labelsVisited);
 }