github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/analyze/vendor_test.go (about)

     1  // Copyright 2023 The GitBundle Inc. All rights reserved.
     2  // Copyright 2017 The Gitea Authors. All rights reserved.
     3  // Use of this source code is governed by a MIT-style
     4  // license that can be found in the LICENSE file.
     5  
     6  package analyze
     7  
     8  import "testing"
     9  
    10  func TestIsVendor(t *testing.T) {
    11  	tests := []struct {
    12  		path string
    13  		want bool
    14  	}{
    15  		{"cache/", true},
    16  		{"random/cache/", true},
    17  		{"cache", false},
    18  		{"dependencies/", true},
    19  		{"Dependencies/", true},
    20  		{"dependency/", false},
    21  		{"dist/", true},
    22  		{"dist", false},
    23  		{"random/dist/", true},
    24  		{"random/dist", false},
    25  		{"deps/", true},
    26  		{"configure", true},
    27  		{"a/configure", true},
    28  		{"config.guess", true},
    29  		{"config.guess/", false},
    30  		{".vscode/", true},
    31  		{"doc/_build/", true},
    32  		{"a/docs/_build/", true},
    33  		{"a/dasdocs/_build-vsdoc.js", true},
    34  		{"a/dasdocs/_build-vsdoc.j", false},
    35  	}
    36  	for _, tt := range tests {
    37  		t.Run(tt.path, func(t *testing.T) {
    38  			if got := IsVendor(tt.path); got != tt.want {
    39  				t.Errorf("IsVendor() = %v, want %v", got, tt.want)
    40  			}
    41  		})
    42  	}
    43  }