add basic ParseTargets test

Note: needs refactoring to include an actual alias map example. I was
unable to get this to work for the time being, but this test adds at
least some coverage.
This commit is contained in:
Kent Gruber 2018-05-01 10:05:52 -04:00
commit b188354c33

View file

@ -32,3 +32,17 @@ func TestNormalizeMac(t *testing.T) {
t.Fatalf("expected '%s', got '%s'", exp, got)
}
}
// TODO: refactor to parse targets with an actual alias map
func TestParseTargets(t *testing.T) {
ips, macs, err := ParseTargets("192.168.1.2, 192.168.1.3", &Aliases{})
if err != nil {
t.Error("ips:", ips, "macs:", macs, "err:", err)
}
if len(ips) != 2 {
t.Fatalf("expected '%d', got '%d'", 2, len(ips))
}
if len(macs) != 0 {
t.Fatalf("expected '%d', got '%d'", 0, len(macs))
}
}