use of com.google.copybara.TransformationStatus in project copybara by google.
the class ReplaceTest method noopReplaceAsWarning.
@Test
public void noopReplaceAsWarning() throws Exception {
writeFile(checkoutDir.resolve("foo"), "");
TransformationStatus status = transform(eval("core.replace(\n" + " before = \"BEFORE this string doesn't appear anywhere in source\",\n" + " after = 'lulz',\n" + ")"));
assertThat(status.isNoop()).isTrue();
assertThat(status.getMessage()).matches(".*BEFORE.*lulz.*was a no-op because it didn't change any of the matching files");
status = transform(eval("core.replace(\n" + " before = \"BEFORE this string doesn't appear anywhere in source\",\n" + " after = 'lulz',\n" + " paths = glob(['bad_path/**'])\n" + ")"));
assertThat(status.isNoop()).isTrue();
assertThat(status.getMessage()).matches(".*BEFORE.*lulz.*was a no-op because it didn't match any file");
}
use of com.google.copybara.TransformationStatus in project copybara by google.
the class ReplaceTest method nopReplaceShouldThrowException.
@Test
public void nopReplaceShouldThrowException() throws Exception {
Replace replace = eval("core.replace(\n" + " before = \"this string doesn't appear anywhere in source\",\n" + " after = 'lulz',\n" + ")");
TransformationStatus status = transform(replace);
assertThat(status.isNoop()).isTrue();
}
Aggregations