package util

import (
	"os/exec"
	"reflect"
	"sort"
	"strings"
	"testing"
)

func TestRootNames(t *testing.T) {
	// NOTE: will fail if there are newlines in /*.
	want, err := exec.Command("ls", "-A", "/").Output()
	mustOK(err)
	wantNames := strings.Split(strings.Trim(string(want), "\n"), "\n")
	for i := range wantNames {
		wantNames[i] = "/" + wantNames[i]
	}

	names := RootNames()

	sort.Strings(wantNames)
	sort.Strings(names)

	if !reflect.DeepEqual(names, wantNames) {
		t.Errorf("RootNames() -> %s, want %s", names, wantNames)
	}
}

package util

import (
	"os/exec"
	"reflect"
	"sort"
	"strings"
	"testing"
)

func TestRootNames(t *testing.T) {
	// NOTE: will fail if there are newlines in /*.
	want, err := exec.Command("ls", "/").Output()
	mustOK(err)
	wantNames := strings.Split(strings.Trim(string(want), "\n"), "\n")
	for i := range wantNames {
		wantNames[i] = "/" + wantNames[i]
	}

	names := RootNames()

	sort.Strings(wantNames)
	sort.Strings(names)

	if !reflect.DeepEqual(names, wantNames) {
		t.Errorf("RootNames() -> %s, want %s", names, wantNames)
	}
}

--- 
+++ 
@@ -10,7 +10,7 @@
 
 func TestRootNames(t *testing.T) {
 	// NOTE: will fail if there are newlines in /*.
-	want, err := exec.Command("ls", "/").Output()
+	want, err := exec.Command("ls", "-A", "/").Output()
 	mustOK(err)
 	wantNames := strings.Split(strings.Trim(string(want), "\n"), "\n")
 	for i := range wantNames {
Use "ls -A" to test against RootNames.
