aboutsummaryrefslogtreecommitdiff
path: root/file/names_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-08-04 23:23:51 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-08-04 23:23:51 +0200
commit8084465e13ee600c733b709059dfbaa753603674 (patch)
tree40c070baf9befbc42208d301933859493bb6cbaf /file/names_test.go
parentb1d650c6542a8573ecfb204a037df12731272822 (diff)
Rename file to b64file
Diffstat (limited to 'file/names_test.go')
-rw-r--r--file/names_test.go65
1 files changed, 0 insertions, 65 deletions
diff --git a/file/names_test.go b/file/names_test.go
deleted file mode 100644
index a24faee..0000000
--- a/file/names_test.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package file
-
-import "testing"
-
-func TestCheckNames(t *testing.T) {
- testCases := []struct {
- pub, sec string
- err error
- }{
- {"key.pub", "key.sec", nil},
- {"testdata/key.pub", "key.sec", nil},
- {"key.pub", "testdata/key.sec", nil},
- {"foo.pub", "bar.sec", ErrNames},
- {"key.foo", "key.bar", ErrNames},
- }
- for _, tc := range testCases {
- t.Run(tc.pub+"+"+tc.sec, func(t *testing.T) {
- err := ValidateNames(tc.pub, tc.sec)
- if err != tc.err {
- t.Errorf("got %v, want %v", err, tc.err)
- }
- })
- }
-}
-
-func TestVerify(t *testing.T) {
- testCases := []struct {
- comment string
- file string
- }{
- {"verify with key.pub", "key.pub"},
- {"verify with s p a c e s.pub", "s p a c e s.pub"},
- {"verify with key.sec", ""},
- {"whatever", ""},
- }
- for _, tc := range testCases {
- t.Run(tc.comment, func(t *testing.T) {
- file := PubFile(tc.comment)
- if file != tc.file {
- t.Errorf("got %v, want %v", file, tc.file)
- }
- })
- }
-}
-
-func TestSplit(t *testing.T) {
- testCases := []struct {
- fname, name, ext string
- }{
- {"testkey.pub", "testkey", ".pub"},
- {"testkey", "testkey", ""},
- {".pub", "", ".pub"},
- {".testkey.pub", ".testkey", ".pub"},
- {"", "", ""},
- {"path/key.pub", "key", ".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)
- }
- })
- }
-}