adding ROOT_PATH + tests

This commit is contained in:
Julien Neuhart
2019-12-06 17:23:17 +01:00
parent e255f9bfc5
commit f0f48f4ddf
11 changed files with 244 additions and 62 deletions

View File

@@ -18,3 +18,27 @@ func TestStringOfOne(t *testing.T) {
err = rule.validate()
test.AssertError(t, err)
}
func TestStringStartWith(t *testing.T) {
rule := StringStartWith("foo")
// should be OK.
rule.with("FOO", "foobarfoo")
err := rule.validate()
assert.Nil(t, err)
// should not be OK.
rule.with("FOO", "qux")
err = rule.validate()
test.AssertError(t, err)
}
func TestStringEndWith(t *testing.T) {
rule := StringEndWith("foo")
// should be OK.
rule.with("FOO", "foobarfoo")
err := rule.validate()
assert.Nil(t, err)
// should not be OK.
rule.with("FOO", "qux")
err = rule.validate()
test.AssertError(t, err)
}