github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/pkg/upath/urootpath_test.go (about) 1 // Copyright 2015-2017 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package upath 6 7 import ( 8 "testing" 9 ) 10 11 func TestUrootPath(t *testing.T) { 12 var tests = []struct { 13 name string 14 urootRoot string 15 out string 16 }{ 17 {"ubin/cat", "", "/ubin/cat"}, 18 {"ubin/cat", "/", "/ubin/cat"}, 19 {"ubin/cat", "usr/local", "/usr/local/ubin/cat"}, 20 } 21 22 for _, tt := range tests { 23 root = tt.urootRoot 24 o := UrootPath(tt.name) 25 if o != tt.out { 26 t.Errorf("%v: got %v, want %v", tt, o, tt.out) 27 } 28 } 29 }