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