blob: 5d42c2449e8a4ca24a1c91b6c28fcb131ed71298 (
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 utils_test
import (
"testing"
"github.com/n-peugnet/dna-backup/utils"
)
func TestUnprefix(t *testing.T) {
str, err := utils.Unprefix("foo/bar", "foo/")
if str != "bar" {
t.Errorf("expected: %q, actual: %q", "bar", str)
}
if err != nil {
t.Error(err)
}
str, err = utils.Unprefix("foo/bar", "baz")
if str != "foo/bar" {
t.Errorf("expected: %q, actual: %q", "foo/bar", str)
}
if err == nil {
t.Error("err should not be nil")
}
}
|