mirror of
https://github.com/thegeeklab/drone-yaml.git
synced 2024-11-14 14:30:40 +00:00
34 lines
565 B
Go
34 lines
565 B
Go
|
package legacy
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestMatch(t *testing.T) {
|
||
|
tests := []struct {
|
||
|
config string
|
||
|
result bool
|
||
|
}{
|
||
|
{
|
||
|
config: "pipeline:\n build:\n image: golang:1.11",
|
||
|
result: true,
|
||
|
},
|
||
|
{
|
||
|
config: "\n\npipeline:\n",
|
||
|
result: true,
|
||
|
},
|
||
|
{
|
||
|
config: "\n\npipeline: \n",
|
||
|
result: true,
|
||
|
},
|
||
|
{
|
||
|
config: "---\nkind: pipeline\n",
|
||
|
result: false,
|
||
|
},
|
||
|
}
|
||
|
for i, test := range tests {
|
||
|
b := []byte(test.config)
|
||
|
if got, want := Match(b), test.result; got != want {
|
||
|
t.Errorf("Want IsLegacyBytes %v at index %d,", want, i)
|
||
|
}
|
||
|
}
|
||
|
}
|