diff options
| author | Anton Medvedev <anton@medv.io> | 2025-12-07 16:56:52 +0100 |
|---|---|---|
| committer | Anton Medvedev <anton@medv.io> | 2025-12-07 16:56:52 +0100 |
| commit | 1441fb29d93481f7bea76bbfa2a9f289ed1ac4f0 (patch) | |
| tree | 6d01f974638c519780406f67158c9160cf06e7cc /pkg/git/utils_test.go | |
| parent | 20a5d07b2a4620ace14c6a5f622ca45e27f9c20d (diff) | |
Refactor code by introducing `Ref` type
Diffstat (limited to 'pkg/git/utils_test.go')
| -rw-r--r-- | pkg/git/utils_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkg/git/utils_test.go b/pkg/git/utils_test.go index ecbe952..4dcebe8 100644 --- a/pkg/git/utils_test.go +++ b/pkg/git/utils_test.go @@ -54,3 +54,27 @@ func TestParseFileModeInvalid(t *testing.T) { }) } } + +func TestRefToFileName(t *testing.T) { + tests := []struct { + in string + want string + }{ + {"main", "main"}, + {"master", "master"}, + {"release/v1.0", "release-v1.0"}, + {"feature/add-login", "feature-add-login"}, + {"bugfix\\windows\\path", "bugfix-windows-path"}, + {"1.0.0", "1.0.0"}, + {"1.x", "1.x"}, + } + + for _, tt := range tests { + t.Run(tt.in, func(t *testing.T) { + got := git.RefToFileName(tt.in) + if got != tt.want { + t.Fatalf("refToFileName(%q) = %q, want %q", tt.in, got, tt.want) + } + }) + } +} |
