aboutsummaryrefslogtreecommitdiff
path: root/file/names_test.go
blob: 5c9941a91bf853c0aaf24ee01e722d0d384a414b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package file

import "testing"

func TestNames(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 := Names(tc.pub, tc.sec)
			if err != tc.err {
				t.Errorf("got %v, want %v", err, tc.err)
			}
		})
	}
}