-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for the asynchronous logging assertion feature
This commit also fixes various issues with asynchronous logging: - Standard output could not be an exception if followed by a log. - Unrelated comments were treated as outputs when following a log. - Channel mismatches were not handled. - Inconsistencies in how assertions were shown. - Incorrect handling of exception assertions. It also adds a feature that hints users who don't get their expected output that it may have happened because their test timed out.
- Loading branch information
Showing
3 changed files
with
126 additions
and
32 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,60 @@ | ||
function crash(){ | ||
throw new Error; | ||
} | ||
|
||
// Synchronous log with output | ||
// | ||
// > (stdout (1), 2) | ||
// [stdout]: 1 | ||
// 2 | ||
|
||
// Synchronous log with exception | ||
// | ||
// > (stdout (1), crash()) | ||
// [stdout]: 1 | ||
// ! Error | ||
|
||
// Asynchronous log with output | ||
// | ||
// > (setImmediate (stdout, 1), 2) | ||
// 2 | ||
// [stdout]: 1 | ||
|
||
// Asynchronous log with exception | ||
// | ||
// > (setImmediate (stdout, 1), crash()) | ||
// ! Error | ||
// [stdout]: 1 | ||
|
||
// Failure due to not enough output | ||
// | ||
// > (stdout (1), 3) | ||
// [stdout]: 1 | ||
// [stdout]: 2 | ||
// 3 | ||
|
||
// Failure due to too much output | ||
// | ||
// > (stdout (1), stdout (2), 3) | ||
// [stdout]: 1 | ||
// 3 | ||
|
||
// Failure due to incorrectly ordered output | ||
// | ||
// > (stdout (1), stdout (2), 3) | ||
// [stdout]: 2 | ||
// [stdout]: 1 | ||
// 3 | ||
|
||
// Failure due to output on the wrong channel | ||
// | ||
// > (stdout (1), stdout (2), 3) | ||
// [stdout]: 1 | ||
// [stderr]: 2 | ||
// 3 | ||
|
||
// Failure due to timing out | ||
// | ||
// > (setTimeout (stdout, 200, 1), 2) | ||
// 2 | ||
// [stdout]: 1 |