示例#1
0
  @Test
  public void shouldIgnoreWhenTextIsDocumentInChildOfRootFolder() throws Exception {
    IgnoredFiles ignore = new IgnoredFiles("*/*.doc");

    assertThat(ignore.shouldIgnore(hgMaterialConfig, "A" + separator + "a.doc"), is(true));
    assertThat(ignore.shouldIgnore(hgMaterialConfig, "B" + separator + "c.doc"), is(true));
  }
示例#2
0
  @Test
  public void shouldNormalizeRegex() throws Exception {
    IgnoredFiles ignore = new IgnoredFiles("*\\*.doc");

    assertThat(ignore.shouldIgnore(hgMaterialConfig, "A" + separator + "a.doc"), is(true));
    assertThat(ignore.shouldIgnore(hgMaterialConfig, "B" + separator + "c.doc"), is(true));
  }
示例#3
0
  @Test
  public void shouldSkipDiot() throws Exception {
    IgnoredFiles ignore = new IgnoredFiles("helper/*.*");

    assertThat(
        ignore.shouldIgnore(
            hgMaterialConfig, "helper" + separator + "configuration_reference.html"),
        is(true));
    assertThat(
        ignore.shouldIgnore(
            hgMaterialConfig,
            "helper" + separator + "conf-docs" + separator + "configuration_reference.html"),
        is(false));
    assertThat(
        ignore.shouldIgnore(
            hgMaterialConfig,
            "helper"
                + separator
                + "resources"
                + separator
                + "images"
                + separator
                + "cruise"
                + separator
                + "dependent_build.png"),
        is(false));
  }
示例#4
0
  @Test
  public void shouldIncludeWhenTheTextUnderRootIsNotADocument() {
    IgnoredFiles ignore = new IgnoredFiles("*.doc");

    assertThat(ignore.shouldIgnore(hgMaterialConfig, "a.pdf"), is(false));
    assertThat(ignore.shouldIgnore(hgMaterialConfig, "a.doc.aaa"), is(false));
    assertThat(ignore.shouldIgnore(hgMaterialConfig, "A" + separator + "a.doc"), is(false));
  }
示例#5
0
 @Test
 public void shouldIgnoreIfTextIsUnderAFolderMatchingTheGivenFolder() throws Exception {
   IgnoredFiles ignore = new IgnoredFiles("**/*Test*/*");
   assertThat(
       ignore.shouldIgnore(
           hgMaterialConfig, "B" + separator + "SomethingTestThis" + separator + "isIgnored"),
       is(true));
 }
示例#6
0
 @Test
 public void shouldIgnoreIfTextIsUnderAGivenFolder() throws Exception {
   IgnoredFiles ignore = new IgnoredFiles("**/DocumentFolder/*");
   assertThat(
       ignore.shouldIgnore(
           hgMaterialConfig, "A" + separator + "DocumentFolder" + separator + "d.doc"),
       is(true));
 }
示例#7
0
  @Test
  public void shouldIgnoreWhenTextIsADocumentInAnyFolderWhenDirectoryWildcardNotInTheBegining()
      throws Exception {
    IgnoredFiles ignore = new IgnoredFiles("foo*/**/*.doc");

    assertThat(ignore.shouldIgnore(hgMaterialConfig, "foo-hi/bar/a.doc"), is(true));
    assertThat(ignore.shouldIgnore(hgMaterialConfig, "bar/baz/b.doc"), is(false));
  }
示例#8
0
 @Test
 public void shouldIncludeWhenTextIsNotADocumentInAnyFolder() throws Exception {
   IgnoredFiles ignore = new IgnoredFiles("**/*.doc");
   assertThat(ignore.shouldIgnore(hgMaterialConfig, "a.pdf"), is(false));
   assertThat(ignore.shouldIgnore(hgMaterialConfig, "B" + separator + "a.pdf"), is(false));
   assertThat(
       ignore.shouldIgnore(hgMaterialConfig, "A" + separator + "B" + separator + "a.pdf"),
       is(false));
 }
示例#9
0
 @Test
 public void shouldIncludeIfTextIsNotUnderAFolderMatchingTheGivenFolder() throws Exception {
   IgnoredFiles ignore = new IgnoredFiles("**/*Test*/*");
   assertThat(
       ignore.shouldIgnore(hgMaterialConfig, "A" + separator + "shouldNotBeIgnored.doc"),
       is(false));
   assertThat(
       ignore.shouldIgnore(hgMaterialConfig, "B/NotIgnored" + separator + "isIgnored"), is(false));
 }
示例#10
0
 @Test
 public void shouldEscapeAllValidSpecialCharactersInPattern() { // see mingle #5700
   hgMaterialConfig = new TfsMaterialConfig(new GoCipher());
   IgnoredFiles ignore = new IgnoredFiles("$/tfs_repo/Properties/*.*");
   assertThat(
       ignore.shouldIgnore(
           hgMaterialConfig,
           "$/tfs_repo" + separator + "Properties" + separator + "AssemblyInfo.cs"),
       is(true));
 }
示例#11
0
  @Test
  public void shouldIncludeWhenTheTextDoesnotMatchDocumentUnderRoot() {
    IgnoredFiles ignore = new IgnoredFiles("a.doc");

    assertThat(ignore.shouldIgnore(hgMaterialConfig, "b.doc"), is(false));
    assertThat(ignore.shouldIgnore(hgMaterialConfig, "a.doc1"), is(false));
    assertThat(
        ignore.shouldIgnore(hgMaterialConfig, "A" + separator + "B" + separator + "a.doc"),
        is(false));
    assertThat(ignore.shouldIgnore(hgMaterialConfig, "A" + separator + "a.doc"), is(false));
  }
示例#12
0
 @Test
 public void shouldIncludeIfTheTextIsNotADocumentInTheSpecifiedFolder() throws Exception {
   IgnoredFiles ignore = new IgnoredFiles("ROOTFOLDER/*.doc");
   assertThat(ignore.shouldIgnore(hgMaterialConfig, "shouldNotBeIgnored.doc"), is(false));
   assertThat(
       ignore.shouldIgnore(hgMaterialConfig, "ANYFOLDER" + separator + "shouldNotBeIgnored.doc"),
       is(false));
   assertThat(
       ignore.shouldIgnore(
           hgMaterialConfig,
           "ROOTFOLDER" + separator + "" + "ANYFOLDER" + separator + "shouldNotBeIgnored.doc"),
       is(false));
 }
示例#13
0
 @Test
 public void shouldIgnoreEverythingUnderAFolderWithWildcardsWithoutExtension() throws Exception {
   IgnoredFiles ignore = new IgnoredFiles("Test/**/*");
   assertThat(ignore.shouldIgnore(hgMaterialConfig, "Test" + separator + "foo.txt"), is(true));
   assertThat(
       ignore.shouldIgnore(
           hgMaterialConfig, "Test" + separator + "subdir" + separator + "foo.txt"),
       is(true));
   assertThat(
       ignore.shouldIgnore(
           hgMaterialConfig,
           "Test" + separator + "subdir" + separator + "subdir" + separator + "foo.txt"),
       is(true));
   assertThat(
       ignore.shouldIgnore(
           hgMaterialConfig,
           "Test" + separator + "subdir" + separator + "subdir" + separator + "foo"),
       is(true));
 }
示例#14
0
  @Test
  public void shouldIgnoreWhenTheTextUnderRootIsADocument() {
    IgnoredFiles ignore = new IgnoredFiles("*.doc");

    assertThat(ignore.shouldIgnore(hgMaterialConfig, "a.doc"), is(true));
  }
示例#15
0
 @Test
 public void shouldAddErrorToItsErrorCollection() {
   IgnoredFiles ignore = new IgnoredFiles("helper/*.*");
   ignore.addError("pattern", "not allowed");
   assertThat(ignore.errors().on("pattern"), is("not allowed"));
 }
示例#16
0
 @Test
 public void shouldIncludIgnoreIfTextIsADocumentInTheSpecifiedFolder() throws Exception {
   IgnoredFiles ignore = new IgnoredFiles("ROOTFOLDER/*.doc");
   assertThat(ignore.shouldIgnore(hgMaterialConfig, "ROOTFOLDER" + separator + "a.doc"), is(true));
 }