github.com/khulnasoft-lab/gopkg@v0.0.0-20240121181808-81b44d894093/mirrors/mirrors_test.go (about) 1 package mirrors 2 3 import "testing" 4 5 var oyml = ` 6 repos: 7 - original: github.com/Khulnasoft-lab/goctl-semver 8 repo: file:///path/to/local/repo 9 vcs: git 10 - original: github.com/Khulnasoft-lab/atest 11 repo: github.com/example/atest 12 ` 13 14 var ooutyml = `repos: 15 - original: github.com/Khulnasoft-lab/atest 16 repo: github.com/example/atest 17 - original: github.com/Khulnasoft-lab/goctl-semver 18 repo: file:///path/to/local/repo 19 vcs: git 20 ` 21 22 func 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 }