This commit is contained in:
Sam Boyer 2016-03-17 12:57:39 -04:00
Родитель 3479717240
Коммит 45e0d329f0
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -21,7 +21,7 @@ func solveAndBasicChecks(fixnum int, t *testing.T) Result {
result := s.Solve(p, nil)
if result.SolveFailure != nil {
t.Errorf("(fixture: %s) - Solver failed; error was type %T, text: '%s'", fix.n, result.SolveFailure, result.SolveFailure)
t.Errorf("(fixture: %q) - Solver failed; error was type %T, text: %q", fix.n, result.SolveFailure, result.SolveFailure)
}
// Dump result projects into a map for easier interrogation
@ -33,19 +33,19 @@ func solveAndBasicChecks(fixnum int, t *testing.T) Result {
fixlen, rlen := len(fix.r), len(rp)
if fixlen != rlen {
// Different length, so they definitely disagree
t.Errorf("(fixture: %s) Solver reported %v package results, result expected %v", fix.n, rlen, fixlen)
t.Errorf("(fixture: %q) Solver reported %v package results, result expected %v", fix.n, rlen, fixlen)
}
// Whether or not len is same, still have to verify that results agree
// Walk through fixture/expected results first
for p, v := range fix.r {
if av, exists := rp[p]; !exists {
t.Errorf("(fixture: %s) Project '%s' expected but missing from results", fix.n, p)
t.Errorf("(fixture: %q) Project %q expected but missing from results", fix.n, p)
} else {
// delete result from map so we skip it on the reverse pass
delete(rp, p)
if v != av {
t.Errorf("(fixture: %s) Expected version '%s' of project '%s', but actual version was '%s'", fix.n, v, p, av)
t.Errorf("(fixture: %q) Expected version %q of project %q, but actual version was %q", fix.n, v, p, av)
}
}
}
@ -53,9 +53,9 @@ func solveAndBasicChecks(fixnum int, t *testing.T) Result {
// Now walk through remaining actual results
for p, v := range rp {
if fv, exists := fix.r[p]; !exists {
t.Errorf("(fixture: %s) Unexpected project '%s' present in results", fix.n, p)
t.Errorf("(fixture: %q) Unexpected project %q present in results", fix.n, p)
} else if v != fv {
t.Errorf("(fixture: %s) Got version '%s' of project '%s', but expected version was '%s'", fix.n, v, p, fv)
t.Errorf("(fixture: %q) Got version %q of project %q, but expected version was %q", fix.n, v, p, fv)
}
}