github.com/golang/dep@v0.5.4/gps/typed_radix_test.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package gps
     6  
     7  import "testing"
     8  
     9  // basically a regression test
    10  func TestPathPrefixOrEqual(t *testing.T) {
    11  	if !isPathPrefixOrEqual("foo", "foo") {
    12  		t.Error("Same path should return true")
    13  	}
    14  
    15  	if isPathPrefixOrEqual("foo", "fooer") {
    16  		t.Error("foo is not a path-type prefix of fooer")
    17  	}
    18  
    19  	if !isPathPrefixOrEqual("foo", "foo/bar") {
    20  		t.Error("foo is a path prefix of foo/bar")
    21  	}
    22  
    23  	if isPathPrefixOrEqual("foo", "foo/") {
    24  		t.Error("special case - foo is not a path prefix of foo/")
    25  	}
    26  }