This commit is contained in:
asoseil 2018-02-09 00:17:02 +01:00
parent 21ce614026
commit 83134f9b8d
2 changed files with 9 additions and 3 deletions

View File

@ -348,6 +348,10 @@ func (p *Project) Validate(path string, fcheck bool) bool {
}
// check for a valid ext or path
if e := ext(path); e != "" {
if len(p.Watcher.Exts) == 0{
return false
}
// check ignored
for _, v := range p.Watcher.IgnoredExts {
if v == e {
return false
@ -355,6 +359,7 @@ func (p *Project) Validate(path string, fcheck bool) bool {
}
// supported extensions
for index, v := range p.Watcher.Exts{
println(v)
if e == v {
break
}

View File

@ -128,13 +128,14 @@ func TestProject_Validate(t *testing.T) {
r.Projects = append(r.Projects, Project{
parent: &r,
Watcher: Watch{
Exts: []string{"go","html"},
Exts: []string{},
IgnoredPaths: []string{"/test/ignore"},
},
})
for i, v := range data {
if r.Projects[0].Validate(i, false) != v {
t.Error("Unexpected error", i, "expected", v)
result := r.Projects[0].Validate(i, false)
if result != v {
t.Error("Unexpected error", i, "expected", v, result)
}
}
}