1package winio 2 3import "testing" 4 5func TestRunWithUnavailablePrivilege(t *testing.T) { 6 err := RunWithPrivilege("SeCreateTokenPrivilege", func() error { return nil }) 7 if _, ok := err.(*PrivilegeError); err == nil || !ok { 8 t.Fatal("expected PrivilegeError") 9 } 10} 11 12func TestRunWithPrivileges(t *testing.T) { 13 err := RunWithPrivilege("SeShutdownPrivilege", func() error { return nil }) 14 if err != nil { 15 t.Fatal(err) 16 } 17} 18