github.com/misseven0/notify@v0.0.0-20230519123055-c1422e46da05/util_darwin_test.go (about) 1 // Copyright (c) 2014-2015 The Notify Authors. All rights reserved. 2 // Use of this source code is governed by the MIT license that can be 3 // found in the LICENSE file. 4 5 //go:build darwin 6 // +build darwin 7 8 package notify 9 10 import ( 11 "os" 12 "testing" 13 ) 14 15 func TestCanonicalDarwin(t *testing.T) { 16 cases := [...]caseCanonical{ 17 {"/etc", "/private/etc"}, 18 {"/etc/defaults", "/private/etc/defaults"}, 19 {"/etc/hosts", "/private/etc/hosts"}, 20 {"/tmp", "/private/tmp"}, 21 {"/var", "/private/var"}, 22 } 23 testCanonical(t, cases[:]) 24 } 25 26 func TestCanonicalDarwinMultiple(t *testing.T) { 27 etcsym, err := symlink("/etc", "") 28 if err != nil { 29 t.Fatal(err) 30 } 31 tmpsym, err := symlink("/tmp", "") 32 if err != nil { 33 t.Fatal(nonil(err, os.Remove(etcsym))) 34 } 35 defer removeall(etcsym, tmpsym) 36 cases := [...]caseCanonical{ 37 {etcsym, "/private/etc"}, 38 {etcsym + "/hosts", "/private/etc/hosts"}, 39 {tmpsym, "/private/tmp"}, 40 } 41 testCanonical(t, cases[:]) 42 }