github.com/FabianKramm/notify@v0.9.3-0.20210719135015-4705c29227a1/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 // +build darwin 6 7 package notify 8 9 import ( 10 "os" 11 "testing" 12 ) 13 14 func TestCanonicalDarwin(t *testing.T) { 15 cases := [...]caseCanonical{ 16 {"/etc", "/private/etc"}, 17 {"/etc/defaults", "/private/etc/defaults"}, 18 {"/etc/hosts", "/private/etc/hosts"}, 19 {"/tmp", "/private/tmp"}, 20 {"/var", "/private/var"}, 21 } 22 testCanonical(t, cases[:]) 23 } 24 25 func TestCanonicalDarwinMultiple(t *testing.T) { 26 etcsym, err := symlink("/etc", "") 27 if err != nil { 28 t.Fatal(err) 29 } 30 tmpsym, err := symlink("/tmp", "") 31 if err != nil { 32 t.Fatal(nonil(err, os.Remove(etcsym))) 33 } 34 defer removeall(etcsym, tmpsym) 35 cases := [...]caseCanonical{ 36 {etcsym, "/private/etc"}, 37 {etcsym + "/hosts", "/private/etc/hosts"}, 38 {tmpsym, "/private/tmp"}, 39 } 40 testCanonical(t, cases[:]) 41 }