Skip to content

Commit

Permalink
digraph: fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jul 2, 2014
1 parent c493d60 commit ae07b26
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions digraph/tarjan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ d -> e`)
t.Fatalf("bad: %v", sccs)
}

if cycle[0].(*BasicNode).Name != "c" {
t.Fatalf("bad: %v", cycle)
cycleNodes := make([]string, len(cycle))
for i, c := range cycle {
cycleNodes[i] = c.(*BasicNode).Name
}
if cycle[1].(*BasicNode).Name != "b" {
t.Fatalf("bad: %v", cycle)
sort.Strings(cycleNodes)

expected := []string{"b", "c"}
if !reflect.DeepEqual(cycleNodes, expected) {
t.Fatalf("bad: %#v", cycleNodes)
}
}

Expand Down

0 comments on commit ae07b26

Please sign in to comment.