-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added stdout/stderr output validation (#147)
Thanks to @gerdreiss for the following commits which were squashed: - added tracking for symbol use - adapted test case * - using Set instead of List for used definitions * - moved the usage state to class Definition - moved the usage check to class Scope * - converted Definition constructor param "used" to member variable - added output verification to test case * - print warning yellow and bold - added output verification to test case * - Stdout/stderr output validation * - Stdout/stderr output validation * - Stdout/stderr output validation including included and child scopes
- Loading branch information
Showing
13 changed files
with
171 additions
and
9 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
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
29 changes: 29 additions & 0 deletions
29
cli/src/test/scala/co/uproot/abandon/StdoutArgsDirSuite.scala
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 @@ | ||
package co.uproot.abandon | ||
|
||
import java.nio.file.Path | ||
|
||
/** | ||
* Abandon specific default arguments for test cases where output to stdout/stderr needs to be tested as well | ||
*/ | ||
class StdoutArgsDirSuite extends DefaultArgsDirSuite { | ||
|
||
/** | ||
* Get configuration path based on name of current test case. | ||
* | ||
* Add stdout/stderr files to the argument array mapped by DefaultArgsDirSuite | ||
*/ | ||
override | ||
protected def mapArgs(testname: Path, args: Array[String]): Array[String] = { | ||
val fu = fi.sn127.utils.fs.FileUtils(testname.getFileSystem) | ||
val testDir = fu.getParentDirPath(testname) | ||
|
||
val basename = fu.getBasename(testname) match { case (base, _) => base } | ||
val stdout = "out." + basename.toString + ".stdout.txt" | ||
val stderr = "out." + basename.toString + ".stderr.txt" | ||
|
||
val fullPathStdout = fu.getPath(testDir.toString, stdout).toString | ||
val fullPathStderr = fu.getPath(testDir.toString, stderr).toString | ||
|
||
Array(fullPathStdout, fullPathStderr) ++ super.mapArgs(testname, args) | ||
} | ||
} |
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,11 @@ | ||
def unusedInclude = 0 | ||
def x = 200 | ||
def y = 400 | ||
|
||
{ | ||
def nestedUnused2 = 10 | ||
} | ||
|
||
2016/May/2 | ||
inExpenses topX | ||
inBank |
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,20 @@ | ||
include "sym01-include.ledger" | ||
|
||
def unusedTxns = 1 | ||
def topX = 2000 | ||
|
||
{ | ||
def nestedUnused1 = 10 | ||
} | ||
|
||
2016/May/1 | ||
expenses x * 2 | ||
bank | ||
|
||
2016/May/2 | ||
expenses y * 3 | ||
bank -y * 3 | ||
|
||
2016/May/3 | ||
expenses y - x | ||
bank x - y |
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,9 @@ | ||
inputs += sym01-txns.ledger | ||
|
||
exports += { | ||
type = journal | ||
format = xml | ||
outFiles = ["out.sym01.journal.xml"] | ||
} | ||
|
||
reports = [] |
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 @@ | ||
# format: exec | ||
exec: |
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,22 @@ | ||
<abandon> | ||
<journal> | ||
<transactions> | ||
<txn date="2016-05-01"> | ||
<post delta="400" name="expenses"></post> | ||
<post delta="-400" name="bank"></post> | ||
</txn> | ||
<txn date="2016-05-02"> | ||
<post delta="1200" name="expenses"></post> | ||
<post delta="-1200" name="bank"></post> | ||
</txn> | ||
<txn date="2016-05-02"> | ||
<post delta="2000" name="inExpenses"></post> | ||
<post delta="-2000" name="inBank"></post> | ||
</txn> | ||
<txn date="2016-05-03"> | ||
<post delta="200" name="expenses"></post> | ||
<post delta="-200" name="bank"></post> | ||
</txn> | ||
</transactions> | ||
</journal> | ||
</abandon> |
Empty file.
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,4 @@ | ||
[33m[1msymbol 'unusedTxns' defined in sym01-txns.ledger line 3 but never used[0m | ||
[33m[1msymbol 'unusedInclude' defined in sym01-include.ledger line 1 but never used[0m | ||
[33m[1msymbol 'nestedUnused2' defined in sym01-include.ledger line 6 but never used[0m | ||
[33m[1msymbol 'nestedUnused1' defined in sym01-txns.ledger line 7 but never used[0m |