test(config/file): add format test (#2147) (#2168)

pull/2175/head
shengzhou 2 years ago committed by GitHub
parent 8d0d7838ca
commit dec323113f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      config/file/format_test.go

@ -0,0 +1,41 @@
package file
import "testing"
func TestFormat(t *testing.T) {
tests := []struct {
input string
expect string
}{
{
input: "",
expect: "",
},
{
input: " ",
expect: "",
},
{
input: ".",
expect: "",
},
{
input: "a.",
expect: "",
},
{
input: ".b",
expect: "b",
},
{
input: "a.b",
expect: "b",
},
}
for _, v := range tests {
content := format(v.input)
if got, want := content, v.expect; got != want {
t.Errorf("expect %v,got %v", want, got)
}
}
}
Loading…
Cancel
Save