-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
10 changed files
with
75 additions
and
69 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/-! | ||
This is a dummy file to test the `unused` flag in the import graph. | ||
-/ |
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,2 @@ | ||
import ImportGraphTest.Imports | ||
import ImportGraphTest.Dot |
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 @@ | ||
produced.dot |
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,29 @@ | ||
import ImportGraph.Cli | ||
|
||
def readFile (path : System.FilePath) : IO String := | ||
IO.FS.readFile path | ||
|
||
def runGraphCommand : IO Unit := do | ||
let _ ← IO.Process.output { | ||
cmd := "lake" | ||
args := #["exe", "graph", "--to", "ImportGraph.Cli", "ImportGraphTest/produced.dot"] | ||
} | ||
|
||
def compareOutputs (expected : String) (actual : String) : IO Bool := do | ||
let expectedLines := expected.splitOn "\n" |>.filter (·.trim.length > 0) |>.map String.trim | ||
let actualLines := actual.splitOn "\n" |>.filter (·.trim.length > 0) |>.map String.trim | ||
pure (expectedLines == actualLines) | ||
|
||
/-- info: Test passed: The graph command output matches the expected.dot file. -/ | ||
#guard_msgs in | ||
#eval show IO Unit from do | ||
runGraphCommand | ||
let expectedOutput ← readFile "ImportGraphTest/expected.dot" | ||
let actualOutput ← readFile "ImportGraphTest/produced.dot" | ||
let isEqual ← compareOutputs expectedOutput actualOutput | ||
if isEqual then | ||
IO.println "Test passed: The graph command output matches the expected.dot file." | ||
else | ||
IO.println "Test failed: The graph command output does not match the expected.dot file." | ||
IO.println s!"Expected:\n{expectedOutput}" | ||
IO.println s!"Actual:\n{actualOutput}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
digraph "import_graph" { | ||
"ImportGraph.Unused" [style=filled, fillcolor=lightgray]; | ||
"ImportGraph.CurrentModule"; | ||
"ImportGraph.Lean.Name"; | ||
"ImportGraph.RequiredModules"; | ||
"ImportGraph.Imports"; | ||
"ImportGraph.RequiredModules" -> "ImportGraph.Imports"; | ||
"ImportGraph.Cli"; | ||
"ImportGraph.CurrentModule" -> "ImportGraph.Cli"; | ||
"ImportGraph.Imports" -> "ImportGraph.Cli"; | ||
"ImportGraph.Lean.Name" -> "ImportGraph.Cli"; | ||
"ImportGraph.Unused" -> "ImportGraph.Cli"; | ||
} |
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 was deleted.
Oops, something went wrong.