diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2020-03-26 22:03:15 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2020-03-26 22:03:15 +0000 |
| commit | feff62b8fcff9709dc6c7f0b56ce80a288367f29 (patch) | |
| tree | 68fe8a643179ee60d83ec2a39e1f3a4e2ac77cde /internal/lib_test.go | |
| parent | 3216dc9b8d876f24ed561e81c2a1fb91926cb57a (diff) | |
Standardize the project layout
https://github.com/golang-standards/project-layout seems sensible.
Diffstat (limited to 'internal/lib_test.go')
| -rw-r--r-- | internal/lib_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/lib_test.go b/internal/lib_test.go new file mode 100644 index 0000000..19a880d --- /dev/null +++ b/internal/lib_test.go @@ -0,0 +1,23 @@ +// Copyright (c) 2019, Grégoire Duchêne <gduchene@awhk.org> +// +// Use of this source code is governed by the ISC license that can be +// found in the LICENSE file. + +package internal + +import "testing" + +func TestGetDest(t *testing.T) { + cs := []struct{ srcPrefix, destPrefix, pkg, expected string }{ + {"src.example.com/x/", "https://example.com/git/", "src.example.com/x/foo", "https://example.com/git/foo"}, + {"src.example.com/x/", "https://example.com/git/", "src.example.com/x/foo/bar", "https://example.com/git/foo"}, + {"src.example.com/x", "https://example.com/git", "src.example.com/x/foo", "https://example.com/git/foo"}, + {"src.example.com/x", "https://example.com/git", "src.example.com/x/foo/bar", "https://example.com/git/foo"}, + } + for _, c := range cs { + actual := GetDest(c.srcPrefix, c.destPrefix, c.pkg) + if actual != c.expected { + t.Errorf("expected %s, got %s", c.expected, actual) + } + } +} |
