github.com/khulnasoft-lab/gopkg@v0.0.0-20240121181808-81b44d894093/tree/tree_test.go (about)

     1  /*
     2  	Package tree contains functions for printing a dependency tree.
     3  
     4  The future of the tree functionality is uncertain, as it is neither core to
     5  the functionality of Gopkg, nor particularly complementary. Its principal use
     6  case is for debugging the generated dependency tree.
     7  
     8  Currently, the tree package builds its dependency tree in a slightly different
     9  way than the `dependency` package does. This should not make any practical
    10  difference, though code-wise it would be nice to change this over to use the
    11  `dependency` resolver.
    12  */
    13  package tree
    14  
    15  import (
    16  	"container/list"
    17  	"testing"
    18  )
    19  
    20  func TestFindInTree(t *testing.T) {
    21  	l := list.New()
    22  	l.PushBack("github.com/Khulnasoft-lab/gopkg")
    23  	l.PushBack("github.com/Khulnasoft-lab/vcs")
    24  	l.PushBack("github.com/Khulnasoft-lab/goctl-semver")
    25  
    26  	f := findInList("foo", l)
    27  	if f != false {
    28  		t.Error("findInList found true instead of false")
    29  	}
    30  
    31  	f = findInList("github.com/Khulnasoft-lab/vcs", l)
    32  	if f != true {
    33  		t.Error("findInList found false instead of true")
    34  	}
    35  }