mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-08-28 04:46:50 -04:00
1.13 is sufficiently old at this point and net.ErrClosed from 1.16 will be nice to use. This change additionally runs go fmt to bring in the new 1.17 build tag syntax and builds the binaries in our CI with 1.17+. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
21 lines
460 B
Go
21 lines
460 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
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)
|
|
}
|
|
}
|