23 lines
460 B
Go
23 lines
460 B
Go
package birdfmt
|
|
|
|
import "testing"
|
|
|
|
func TestValidateIncludePath(t *testing.T) {
|
|
if err := ValidateIncludePath("bird.d/x.conf"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := ValidateIncludePath("../etc/passwd"); err == nil {
|
|
t.Fatal("expected error for ..")
|
|
}
|
|
}
|
|
|
|
func TestJoinFragments(t *testing.T) {
|
|
got := JoinFragments("a", "", "b")
|
|
if got != "a\n\nb\n" {
|
|
t.Fatalf("%q", got)
|
|
}
|
|
if JoinFragments() != "" {
|
|
t.Fatal("empty join should be empty")
|
|
}
|
|
}
|