MCPcopy
hub / github.com/hashicorp/packer / TestExtractMachineReadable

Function TestExtractMachineReadable

main_test.go:39–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func 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
68func TestRandom(t *testing.T) {
69 if rand.Intn(9999999) == 8498210 {

Callers

nothing calls this directly

Calls 2

extractMachineReadableFunction · 0.85
FatalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…