forked from lunarmodules/busted
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lunarmodules#521 from o-lim/stdin-compatibility
Support running standalone tests from stdin
- Loading branch information
Showing
9 changed files
with
72 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
local getTrace = function(filename, info) | ||
local index = info.traceback:find('\n%s*%[C]') | ||
info.traceback = info.traceback:sub(1, index) | ||
return info | ||
end | ||
|
||
return function(busted) | ||
local loadCurrentFile = function(info, options) | ||
local filename = 'string' | ||
if info.source:sub(1,1) == '@' or info.source:sub(1,1) == '=' then | ||
filename = info.source:sub(2) | ||
end | ||
|
||
-- Setup test file to be compatible with live coding | ||
if info.func then | ||
local file = setmetatable({ | ||
getTrace = getTrace, | ||
rewriteMessage = nil | ||
}, { | ||
__call = info.func | ||
}) | ||
|
||
busted.executors.file(filename, file) | ||
end | ||
end | ||
|
||
return loadCurrentFile | ||
end |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
return { | ||
standalone = true, | ||
defaultOutput = 'utfTerminal', | ||
output = nil, | ||
} |
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