mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-08-28 12:56:33 -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>
30 lines
746 B
Go
30 lines
746 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package winio
|
|
|
|
import "testing"
|
|
|
|
func TestLookupInvalidSid(t *testing.T) {
|
|
_, err := LookupSidByName(".\\weoifjdsklfj")
|
|
aerr, ok := err.(*AccountLookupError)
|
|
if !ok || aerr.Err != cERROR_NONE_MAPPED {
|
|
t.Fatalf("expected AccountLookupError with ERROR_NONE_MAPPED, got %s", err)
|
|
}
|
|
}
|
|
|
|
func TestLookupValidSid(t *testing.T) {
|
|
sid, err := LookupSidByName("Everyone")
|
|
if err != nil || sid != "S-1-1-0" {
|
|
t.Fatalf("expected S-1-1-0, got %s, %s", sid, err)
|
|
}
|
|
}
|
|
|
|
func TestLookupEmptyNameFails(t *testing.T) {
|
|
_, err := LookupSidByName("")
|
|
aerr, ok := err.(*AccountLookupError)
|
|
if !ok || aerr.Err != cERROR_NONE_MAPPED {
|
|
t.Fatalf("expected AccountLookupError with ERROR_NONE_MAPPED, got %s", err)
|
|
}
|
|
}
|