(t *testing.T)
| 844 | } |
| 845 | |
| 846 | func TestSkipIgnoredDirs(t *testing.T) { |
| 847 | fss := fs.NewFilesystem(fs.FilesystemTypeFake, "") |
| 848 | |
| 849 | name := "foo/ignored" |
| 850 | err := fss.MkdirAll(name, 0o777) |
| 851 | if err != nil { |
| 852 | t.Fatal(err) |
| 853 | } |
| 854 | |
| 855 | stat, err := fss.Lstat(name) |
| 856 | if err != nil { |
| 857 | t.Fatal(err) |
| 858 | } |
| 859 | |
| 860 | w := &walker{} |
| 861 | |
| 862 | pats := ignore.New(fss, ignore.WithCache(true)) |
| 863 | |
| 864 | stignore := ` |
| 865 | /foo/ign* |
| 866 | !/f* |
| 867 | * |
| 868 | ` |
| 869 | if err := pats.Parse(bytes.NewBufferString(stignore), ".stignore"); err != nil { |
| 870 | t.Fatal(err) |
| 871 | } |
| 872 | if m := pats.Match("whatever"); !m.CanSkipDir() { |
| 873 | t.Error("CanSkipDir should be true", m) |
| 874 | } |
| 875 | |
| 876 | w.Matcher = pats |
| 877 | |
| 878 | fn := w.walkAndHashFiles(context.Background(), nil, nil) |
| 879 | |
| 880 | if err := fn(name, stat, nil); err != fs.SkipDir { |
| 881 | t.Errorf("Expected %v, got %v", fs.SkipDir, err) |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | // https://github.com/syncthing/syncthing/issues/6487 |
| 886 | func TestIncludedSubdir(t *testing.T) { |
nothing calls this directly
no test coverage detected