-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db0f2b5
commit 89cfc5b
Showing
5 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package analysis | ||
|
||
import ( | ||
"regexp" | ||
"testing" | ||
|
||
"github.com/sandstorm/dependency-analysis/dataStructures" | ||
) | ||
|
||
// this test runs the code analysis against this project | ||
// if you change the package structure, you need to adjust the expectations as well | ||
func TestBuildDependencyGraph(t *testing.T) { | ||
t.Run("analyze sda", func(t *testing.T) { | ||
settings := &AnalyzerSettings{ | ||
SourcePath: "..", | ||
Depth: 1, | ||
IncludePattern: regexp.MustCompile(".*"), | ||
} | ||
actual, err := BuildDependencyGraph(settings) | ||
AssertNil(t, err) | ||
expected := dataStructures.NewDirectedStringGraph(). | ||
AddEdge("main", "cmd"). | ||
AddEdge("cmd", "analysis"). | ||
AddEdge("cmd", "dataStructures"). | ||
AddEdge("cmd", "rendering"). | ||
AddEdge("analysis", "parsing"). | ||
AddEdge("analysis", "dataStructures"). | ||
AddEdge("parsing", "dataStructures"). | ||
AddEdge("rendering", "dataStructuress") | ||
AssertEquals(t, "incorrect graph", expected, actual) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters