(t *testing.T)
| 37 | } |
| 38 | |
| 39 | func TestExtractMachineReadable(t *testing.T) { |
| 40 | var args, expected, result []string |
| 41 | var mr bool |
| 42 | |
| 43 | // Not |
| 44 | args = []string{"foo", "bar", "baz"} |
| 45 | result, mr = extractMachineReadable(args) |
| 46 | expected = []string{"foo", "bar", "baz"} |
| 47 | if !reflect.DeepEqual(result, expected) { |
| 48 | t.Fatalf("bad: %#v", result) |
| 49 | } |
| 50 | |
| 51 | if mr { |
| 52 | t.Fatal("should not be mr") |
| 53 | } |
| 54 | |
| 55 | // Yes |
| 56 | args = []string{"foo", "-machine-readable", "baz"} |
| 57 | result, mr = extractMachineReadable(args) |
| 58 | expected = []string{"foo", "baz"} |
| 59 | if !reflect.DeepEqual(result, expected) { |
| 60 | t.Fatalf("bad: %#v", result) |
| 61 | } |
| 62 | |
| 63 | if !mr { |
| 64 | t.Fatal("should be mr") |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func TestRandom(t *testing.T) { |
| 69 | if rand.Intn(9999999) == 8498210 { |
nothing calls this directly
no test coverage detected
searching dependent graphs…