github.com/sdboyer/gps@v0.16.3/typed_radix_test.go (about)

     1  package gps
     2  
     3  import "testing"
     4  
     5  // basically a regression test
     6  func TestPathPrefixOrEqual(t *testing.T) {
     7  	if !isPathPrefixOrEqual("foo", "foo") {
     8  		t.Error("Same path should return true")
     9  	}
    10  
    11  	if isPathPrefixOrEqual("foo", "fooer") {
    12  		t.Error("foo is not a path-type prefix of fooer")
    13  	}
    14  
    15  	if !isPathPrefixOrEqual("foo", "foo/bar") {
    16  		t.Error("foo is a path prefix of foo/bar")
    17  	}
    18  
    19  	if isPathPrefixOrEqual("foo", "foo/") {
    20  		t.Error("special case - foo is not a path prefix of foo/")
    21  	}
    22  }