utils test start

This commit is contained in:
Henrique Dias
2015-09-20 22:20:37 +01:00
parent 6f972d1ae4
commit 1e2895a437
2 changed files with 104 additions and 65 deletions

39
utils/utils_test.go Normal file
View File

@@ -0,0 +1,39 @@
package utils
import "testing"
type canBeEdited struct {
file string
result bool
}
var canBeEditedPairs = []canBeEdited{
{"file.markdown", true},
{"file.md", true},
{"file.json", true},
{"file.toml", true},
{"file.yaml", true},
{"file.css", true},
{"file.sass", true},
{"file.scss", true},
{"file.js", true},
{"file.html", true},
{"file.git", false},
{"file.log", false},
{"file.sh", false},
{"file.png", false},
{"file.jpg", false},
}
func TestCanBeEdited(t *testing.T) {
for _, pair := range canBeEditedPairs {
v := CanBeEdited(pair.file)
if v != pair.result {
t.Error(
"For", pair.file,
"expected", pair.result,
"got", v,
)
}
}
}