initial commit

This commit is contained in:
Clayton Craft
2021-08-09 14:45:28 -07:00
parent d6a85fd8a0
commit 64195a5f83
7 changed files with 1732 additions and 0 deletions

25
main_test.go Normal file
View File

@@ -0,0 +1,25 @@
// Copyright 2021 Clayton Craft <clayton@craftyguy.net>
// SPDX-License-Identifier: GPL-3.0-or-later
package main
import (
"testing"
)
func TestStripExts(t *testing.T) {
tables := []struct {
in string
expected string
}{
{"/foo/bar/bazz.tar", "/foo/bar/bazz"},
{"file.tar.gz.xz.zip", "file"},
{"another_file", "another_file"},
{"a.b.c.d.e.f.g.h.i", "a"},
}
for _, table := range tables {
out := stripExts(table.in)
if out != table.expected {
t.Errorf("Expected: %q, got: %q", table.expected, out)
}
}
}