aboutsummaryrefslogtreecommitdiff
path: root/file/names_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-05-03 14:39:06 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-05-03 14:39:06 +0200
commita60a43fadb0ebc1a5c87fc36a77c6b8d671fba95 (patch)
treef076b0a01e428d7beed38b86a69ee534457103c9 /file/names_test.go
parentf96a2c43ac81acd7f51fafa109770b6744c4959d (diff)
test split
Diffstat (limited to 'file/names_test.go')
-rw-r--r--file/names_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/file/names_test.go b/file/names_test.go
index d57d6ee..f4d474b 100644
--- a/file/names_test.go
+++ b/file/names_test.go
@@ -42,3 +42,23 @@ func TestVerify(t *testing.T) {
})
}
}
+
+func TestSplit(t *testing.T) {
+ testCases := []struct {
+ fname, name, ext string
+ }{
+ {"testkey.pub", "testkey", ".pub"},
+ {"testkey", "testkey", ""},
+ {".pub", "", ".pub"},
+ {".testkey.pub", ".testkey", ".pub"},
+ {"", "", ""},
+ }
+ for _, tc := range testCases {
+ t.Run(tc.fname, func(t *testing.T) {
+ name, ext := splitNameExt(tc.fname)
+ if name != tc.name || ext != tc.ext {
+ t.Errorf("got %q %q, want %q %q", name, tc.name, ext, tc.ext)
+ }
+ })
+ }
+}