package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"strconv"
	"testing"
)

func TestListDir(t *testing.T) {
	d := t.TempDir()
	want := []string{}
	for i := 0; i < 3; i++ {
		p := path.Join(d, strconv.Itoa(i))
		ioutil.WriteFile(p, []byte{}, os.ModePerm)
		want = append(want, p)
	}
	os.Mkdir(path.Join(d, "d"), os.ModePerm)

	got, err := listDir(d)
	if err != nil {
		t.Fatal(err)
	}
	if fmt.Sprint(want) != fmt.Sprint(got) {
		t.Fatal(want, got)
	}
}
