summaryrefslogtreecommitdiff
path: root/fs_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'fs_test.go')
-rw-r--r--fs_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs_test.go b/fs_test.go
new file mode 100644
index 0000000..4e36469
--- /dev/null
+++ b/fs_test.go
@@ -0,0 +1,24 @@
+package planr
+
+import (
+ "testing"
+)
+
+func TestCname(t *testing.T) {
+ ROOT := "/home/rubric"
+
+ v := [] struct { path, cname string } {
+ {"/home/rubric/tc1.toml", "tc1" },
+ {"/home/rubric/alpha/tc1.toml", "alpha.tc1" },
+ {"/home/rubric/alpha/beta/tc2.toml", "alpha.beta.tc2"},
+ {"/home/rubric/.a/_b./.abcd.toml", ".a._b...abcd"},
+ }
+
+ for _, vec := range v {
+ got := cname(ROOT, vec.path)
+
+ if vec.cname != got {
+ t.Fatalf("Cname(%s) = %s, wanted %s", vec.path, got, vec.cname)
+ }
+ }
+}