Files
docker-cli/components/engine/pkg/graphdb/sort_test.go
Solomon Hykes 10227320c8 Move utility package 'graphdb' to pkg/graphdb
Upstream-commit: d16d748132330ff58e142472a579d1f6c65e3eac
Component: engine
2013-12-23 23:33:06 +00:00

30 lines
481 B
Go

package graphdb
import (
"testing"
)
func TestSort(t *testing.T) {
paths := []string{
"/",
"/myreallylongname",
"/app/db",
}
sortByDepth(paths)
if len(paths) != 3 {
t.Fatalf("Expected 3 parts got %d", len(paths))
}
if paths[0] != "/app/db" {
t.Fatalf("Expected /app/db got %s", paths[0])
}
if paths[1] != "/myreallylongname" {
t.Fatalf("Expected /myreallylongname got %s", paths[1])
}
if paths[2] != "/" {
t.Fatalf("Expected / got %s", paths[2])
}
}