github.com/joey-fossa/fossa-cli@v0.7.34-0.20190708193710-569f1e8679f0/analyzers/rust/rust_test.go (about)

     1  package rust_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  
     8  	"github.com/fossas/fossa-cli/analyzers/rust"
     9  	"github.com/fossas/fossa-cli/module"
    10  	"github.com/fossas/fossa-cli/pkg"
    11  )
    12  
    13  // Check that we can find Cargo.lock but don't find Cargo.toml.
    14  func TestDiscovery(t *testing.T) {
    15  	options := make(map[string]interface{})
    16  	modules, err := rust.Discover("testdata", options)
    17  	assert.NoError(t, err)
    18  	assert.Len(t, modules, 1)
    19  	expected := module.Module{
    20  		Name:        "testdata/Cargo.lock",
    21  		Type:        pkg.Rust,
    22  		Dir:         ".",
    23  		BuildTarget: ".",
    24  	}
    25  	assert.Equal(t, modules[0], expected)
    26  }