21 lines
629 B
Go
21 lines
629 B
Go
package host
|
||
|
||
import "testing"
|
||
|
||
func TestDefenderExclusionCommand(t *testing.T) {
|
||
for input, escaped := range map[string]string{
|
||
` D:\VM Data `: `D:\VM Data`,
|
||
`D:\Rei's ‘VM’`: `D:\Rei''s ‘‘VM’’`,
|
||
"D:\\VM\r\n\x00\x1b\t\u2028Data": `D:\VMData`,
|
||
" \r\n\x00\t": "",
|
||
} {
|
||
want := ""
|
||
if escaped != "" {
|
||
want = "Add-MpPreference -ExclusionPath '" + escaped + "' -ExclusionProcess 'qemu-system-x86_64.exe'"
|
||
}
|
||
if got := DefenderExclusionCommand(input); got != want {
|
||
t.Errorf("DefenderExclusionCommand(%q) = %q, want %q", input, got, want)
|
||
}
|
||
}
|
||
}
|