#156 bug fix
This commit is contained in:
parent
21ce614026
commit
83134f9b8d
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue