go.undefinedlabs.com/scopeagent@v0.4.2/agent/dependencies_test.go (about)

     1  package agent
     2  
     3  import (
     4  	"fmt"
     5  	"os/exec"
     6  	"testing"
     7  )
     8  
     9  var mp map[string]string
    10  
    11  func BenchmarkGetDependencyMap(b *testing.B) {
    12  	for i := 0; i < b.N; i++ {
    13  		mp = getDependencyMap()
    14  	}
    15  }
    16  
    17  func TestGetDependencies(t *testing.T) {
    18  	deps := getDependencyMap()
    19  	fmt.Printf("Dependency Map: %v\n", deps)
    20  	fmt.Printf("Number of dependencies got: %d\n", len(deps))
    21  	if len(deps) == 0 {
    22  		t.FailNow()
    23  	}
    24  	if _, err := exec.Command("go", "list", "-m", "all").Output(); err != nil {
    25  		t.FailNow()
    26  	}
    27  }