1package mirrors 2 3import "testing" 4 5var oyml = ` 6repos: 7- original: github.com/Masterminds/semver 8 repo: file:///path/to/local/repo 9 vcs: git 10- original: github.com/Masterminds/atest 11 repo: github.com/example/atest 12` 13 14var ooutyml = `repos: 15- original: github.com/Masterminds/atest 16 repo: github.com/example/atest 17- original: github.com/Masterminds/semver 18 repo: file:///path/to/local/repo 19 vcs: git 20` 21 22func TestSortMirrors(t *testing.T) { 23 ov, err := FromYaml([]byte(oyml)) 24 if err != nil { 25 t.Error("Unable to read mirrors yaml") 26 } 27 28 out, err := ov.Marshal() 29 if err != nil { 30 t.Error("Unable to marshal mirrors yaml") 31 } 32 33 if string(out) != ooutyml { 34 t.Error("Output mirrors sorting failed") 35 } 36} 37