-
Notifications
You must be signed in to change notification settings - Fork 29
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
44690f8
commit 0cfb918
Showing
5 changed files
with
152 additions
and
24 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,55 @@ | ||
'@TestSuite ET ExpectTests | ||
|
||
namespace ET | ||
|
||
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
'@It tests bug with expectOnce not matching values | ||
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
'@Test reported case | ||
'@Params[[52], true] | ||
'@Params[invalid, false] | ||
'@Params[[invalid], true] | ||
'@Params[["42"], true] | ||
'@Params[[42], false] | ||
function expectOnce_valuesBug_reported(expectedValue, expectMockFail) as void | ||
obj = { | ||
foo: function(arg0) : return arg0 : end function | ||
} | ||
|
||
m.ExpectOnce(obj, "foo", expectedValue) | ||
obj.foo(42) | ||
m.isAutoAssertingMocks = false | ||
m.AssertMocks() | ||
|
||
isFail = m.currentResult.isFail | ||
m.currentResult.Reset() | ||
m.CleanMocks() | ||
m.AssertEqual(isFail, expectMockFail) | ||
end function | ||
|
||
|
||
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
'@It tests mock count limit | ||
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
'@Test mock count limit at least 25 | ||
function expect_mockCountLimitToBeAtLeast25() as void | ||
|
||
interface = {} | ||
|
||
mockCountLimit = 25 | ||
for i = 1 to mockCountLimit step + 1 | ||
keyName = StrI(i).trim() | ||
interface[keyName] = function(arg0) : return arg0 : end function | ||
|
||
expectedArg = "a" | ||
expectedReturnValue = "b" | ||
m.ExpectOnce(interface, keyName, [expectedArg], [expectedReturnValue]) | ||
|
||
interface[keyName](expectedArg) | ||
end for | ||
|
||
end function | ||
|
||
end namespace |
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,51 @@ | ||
namespace RBS.Coverage | ||
|
||
function createLCovOutput() | ||
? "Generating lcov.info file..." | ||
|
||
cc = m.global._rbs_ccn | ||
expectedMap = cc.expectedMap | ||
filePathMap = cc.filePathMap | ||
resolvedMap = cc.resolvedMap | ||
|
||
buffer = "" | ||
|
||
for each module in filePathMap.items() | ||
moduleNumber = module.key | ||
filePath = module.value | ||
packageName = "." | ||
|
||
relativePath = filePath.replace("pkg:", packageName) | ||
sanitizedPath = relativePath.replace("\\", "/") | ||
|
||
buffer += "TN:" + chr(10) | ||
buffer += "SF:" + sanitizedPath + chr(10) | ||
|
||
for each expected in expectedMap[moduleNumber] | ||
lineNumber = expected[0] | ||
SHIFT = 1 | ||
|
||
if (resolvedMap[moduleNumber] <> invalid) and resolvedMap[moduleNumber].doesExist(str(lineNumber)) then | ||
buffer += "DA:" + str(lineNumber + SHIFT) + ",1" + chr(10) | ||
else | ||
buffer += "DA:" + str(lineNumber + SHIFT) + ",0" + chr(10) | ||
end if | ||
end for | ||
|
||
buffer += "end_of_record" + chr(10) | ||
end for | ||
return buffer | ||
end function | ||
|
||
function printLCovInfo() | ||
? | ||
? "+++++++++++++++++++++++++++++++++++++++++++" | ||
? "LCOV.INFO FILE" | ||
? "+++++++++++++++++++++++++++++++++++++++++++" | ||
? | ||
? "+-=-coverage:start" | ||
? RBS.Coverage.createLCovOutput() | ||
? "+-=-coverage:end" | ||
end sub | ||
|
||
end namespace |
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