Skip to content

Commit

Permalink
Add unit test for replaceExt
Browse files Browse the repository at this point in the history
  • Loading branch information
s-l-teichmann committed Sep 27, 2023
1 parent bf009eb commit 46d08e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/csaf_downloader/forwarder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,16 @@ func TestForwarderHTTPClient(t *testing.T) {
t.Fatal("expected to return same client twice")
}
}

func TestForwarderReplaceExtension(t *testing.T) {
for _, x := range [][2]string{
{"foo", "foo.ext"},
{"foo.bar", "foo.ext"},
{".bar", ".ext"},
{"", ".ext"},
} {
if got := replaceExt(x[0], ".ext"); got != x[1] {
t.Fatalf("got %q expected %q", got, x[1])
}
}
}

0 comments on commit 46d08e0

Please sign in to comment.