Merge pull request #212 from Quasilyte/quasilyte/sloppyLen
realize: don't guard against negative length
This commit is contained in:
commit
bcf8507c0b
|
@ -1135,7 +1135,7 @@ func start(c *cli.Context) (err error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
// check project list length
|
// check project list length
|
||||||
if len(r.Schema.Projects) <= 0 {
|
if len(r.Schema.Projects) == 0 {
|
||||||
// create a new project based on given params
|
// create a new project based on given params
|
||||||
project := r.Schema.New(c)
|
project := r.Schema.New(c)
|
||||||
// Add to projects list
|
// Add to projects list
|
||||||
|
|
|
@ -44,7 +44,7 @@ func TestRealize_Prefix(t *testing.T) {
|
||||||
r := Realize{}
|
r := Realize{}
|
||||||
input := "test"
|
input := "test"
|
||||||
result := r.Prefix(input)
|
result := r.Prefix(input)
|
||||||
if len(result) <= 0 && !strings.Contains(result, input) {
|
if len(result) == 0 && !strings.Contains(result, input) {
|
||||||
t.Error("Unexpected error")
|
t.Error("Unexpected error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@ L:
|
||||||
|
|
||||||
// Validate a file path
|
// Validate a file path
|
||||||
func (p *Project) Validate(path string, fcheck bool) bool {
|
func (p *Project) Validate(path string, fcheck bool) bool {
|
||||||
if len(path) <= 0 {
|
if len(path) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// check if skip hidden
|
// check if skip hidden
|
||||||
|
|
|
@ -56,7 +56,7 @@ func TestRealize_add(t *testing.T) {
|
||||||
if err := m.add(); err != nil {
|
if err := m.add(); err != nil {
|
||||||
t.Error("Unexpected error")
|
t.Error("Unexpected error")
|
||||||
}
|
}
|
||||||
if len(m.Projects) <= 0 {
|
if len(m.Projects) == 0 {
|
||||||
t.Error("Unexpected error")
|
t.Error("Unexpected error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue