mirror of
https://github.com/genuinetools/reg.git
synced 2024-08-17 20:40:23 -04:00
18 lines
422 B
Go
18 lines
422 B
Go
![]() |
package winio
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestRunWithUnavailablePrivilege(t *testing.T) {
|
||
|
err := RunWithPrivilege("SeCreateTokenPrivilege", func() error { return nil })
|
||
|
if _, ok := err.(*PrivilegeError); err == nil || !ok {
|
||
|
t.Fatal("expected PrivilegeError")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestRunWithPrivileges(t *testing.T) {
|
||
|
err := RunWithPrivilege("SeShutdownPrivilege", func() error { return nil })
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
}
|