From 73f0d17a673d0ebd9f28e9e8ffb5be7721b6d4e7 Mon Sep 17 00:00:00 2001 From: George Cook Date: Tue, 28 May 2019 11:18:43 -0500 Subject: [PATCH] adds path to test suite output --- dist/rooibosDist.brs | 4 +- docs/Rooibos.brs.html | 2 +- docs/Rooibos_BaseTestSuite.brs.html | 2 +- docs/Rooibos_CommonUtils.brs.html | 2 +- docs/Rooibos_ItemGenerator.brs.html | 2 +- docs/Rooibos_TestRunner.brs.html | 2 +- docs/index.html | 2 +- docs/index.md | 4 + docs/module-BaseTestSuite.html | 2 +- docs/module-CommonUtils.html | 2 +- docs/module-ItemGenerator.html | 2 +- docs/module-TestRunner.html | 2 +- docs/module-rooibosh.html | 2 +- outRun/.roku-deploy-staging/source/main.brs | 69 +-- .../source/tests/AssertionTests.brs | 540 +++++++++--------- .../source/tests/ExpectTests.brs | 45 +- .../source/tests/ParamsTests.brs | 40 +- .../tests/issue_13_afterEach_not_running.brs | 38 +- .../tests/issue_15_tests_only_on_groups.brs | 34 +- .../tests/issue_5_duplicateGroupNames.brs | 42 +- .../source/tests/testUtils.brs | 28 +- .../tests/verifyBeforeEachAfterEach.brs | 58 +- package.json | 2 +- .../source/tests/rooibos/rooibosDist.brs | 4 +- src/Rooibos_TestLogger.brs | 4 +- 25 files changed, 351 insertions(+), 583 deletions(-) diff --git a/dist/rooibosDist.brs b/dist/rooibosDist.brs index 482833ff..0b12f640 100644 --- a/dist/rooibosDist.brs +++ b/dist/rooibosDist.brs @@ -1810,7 +1810,7 @@ sub RBS_LOGGER_PrintTestStatistic(testCase as object) testChar = "|" locationLine = StrI(metaTestCase.lineNumber).trim() end if - locationText = testCase.filePath.trim() + "(" + locationLine + ")" + locationText = "pkg:/" + testCase.filePath.trim() + "(" + locationLine + ")" insetText = "" if (metaTestcase.isParamTest <> true) messageLine = RBS_LOGGER_FillText(" " + testChar + " |--" + metaTestCase.Name + " : ", ".", 80) @@ -1864,7 +1864,7 @@ sub RBS_LOGGER_PrintSuiteSetUp(sName as string) end if end sub sub RBS_LOGGER_PrintMetaSuiteStart(metaTestSuite) - ? metaTestSuite.name; " (" ; metaTestSuite.filePath + "(1))" + ? metaTestSuite.name; " " ; "pkg:/" ; metaTestSuite.filePath + "(1)" end sub sub RBS_LOGGER_PrintSuiteStart(sName as string) ? " |-" ; sName diff --git a/docs/Rooibos.brs.html b/docs/Rooibos.brs.html index 4985e8db..b6b37a73 100644 --- a/docs/Rooibos.brs.html +++ b/docs/Rooibos.brs.html @@ -126,7 +126,7 @@

Rooibos.brs


diff --git a/docs/Rooibos_BaseTestSuite.brs.html b/docs/Rooibos_BaseTestSuite.brs.html index 4e0b268d..9b550baf 100644 --- a/docs/Rooibos_BaseTestSuite.brs.html +++ b/docs/Rooibos_BaseTestSuite.brs.html @@ -2005,7 +2005,7 @@

Rooibos_BaseTestSuite.brs


diff --git a/docs/Rooibos_CommonUtils.brs.html b/docs/Rooibos_CommonUtils.brs.html index df9279e8..e3e3567d 100644 --- a/docs/Rooibos_CommonUtils.brs.html +++ b/docs/Rooibos_CommonUtils.brs.html @@ -598,7 +598,7 @@

Rooibos_CommonUtils.brs


diff --git a/docs/Rooibos_ItemGenerator.brs.html b/docs/Rooibos_ItemGenerator.brs.html index 95ba713f..b7044e32 100644 --- a/docs/Rooibos_ItemGenerator.brs.html +++ b/docs/Rooibos_ItemGenerator.brs.html @@ -273,7 +273,7 @@

Rooibos_ItemGenerator.brs


diff --git a/docs/Rooibos_TestRunner.brs.html b/docs/Rooibos_TestRunner.brs.html index 2388ebb7..1ca2788a 100644 --- a/docs/Rooibos_TestRunner.brs.html +++ b/docs/Rooibos_TestRunner.brs.html @@ -437,7 +437,7 @@

Rooibos_TestRunner.brs


diff --git a/docs/index.html b/docs/index.html index 7139e762..77e3a790 100644 --- a/docs/index.html +++ b/docs/index.html @@ -57,7 +57,7 @@
diff --git a/docs/index.md b/docs/index.md index bde21a82..2c7ccfad 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1041,6 +1041,10 @@ Recording coverage means modifying your sources! you should only run the coverag These files should be cleaned and recopied _every time you run coverage_ or you will get compile errors/other undetermined behaviour. +#### WARNING - Running code coverage is slower and may crash your device + +Running a code coverage report is a lot slower than a standard test, due to conitnual probing of your source. Only run coverage when needed. Also - be aware it will crash very tight loops, like inside of a while waiting on a port, which will in fact crash and hard reset your device. + ### Recording coverage To record coverage, set the `sourceFilePattern` to a glob matching (including and excluding) the files that should be included in your coverage report, and set the `isRecordingCodeCoverage` flag to true. Be careful to not include your test specs!! diff --git a/docs/module-BaseTestSuite.html b/docs/module-BaseTestSuite.html index c594a567..96d9f62b 100644 --- a/docs/module-BaseTestSuite.html +++ b/docs/module-BaseTestSuite.html @@ -12420,7 +12420,7 @@
Returns:

diff --git a/docs/module-CommonUtils.html b/docs/module-CommonUtils.html index 22bcde8b..28f84d6e 100644 --- a/docs/module-CommonUtils.html +++ b/docs/module-CommonUtils.html @@ -5062,7 +5062,7 @@
Returns:

diff --git a/docs/module-ItemGenerator.html b/docs/module-ItemGenerator.html index 611f871e..affccd54 100644 --- a/docs/module-ItemGenerator.html +++ b/docs/module-ItemGenerator.html @@ -1442,7 +1442,7 @@
Returns:

diff --git a/docs/module-TestRunner.html b/docs/module-TestRunner.html index 914dad44..7dc5fe48 100644 --- a/docs/module-TestRunner.html +++ b/docs/module-TestRunner.html @@ -651,7 +651,7 @@

Run
- Generated by JSDoc 3.5.5 on Mon May 27 2019 21:13:28 GMT-0500 (-05) using the Minami theme. + Generated by JSDoc 3.5.5 on Tue May 28 2019 11:14:36 GMT-0500 (-05) using the Minami theme.
diff --git a/docs/module-rooibosh.html b/docs/module-rooibosh.html index 1e2db575..b2bede08 100644 --- a/docs/module-rooibosh.html +++ b/docs/module-rooibosh.html @@ -294,7 +294,7 @@
Parameters:

- Generated by JSDoc 3.5.5 on Mon May 27 2019 21:13:28 GMT-0500 (-05) using the Minami theme. + Generated by JSDoc 3.5.5 on Tue May 28 2019 11:14:36 GMT-0500 (-05) using the Minami theme.
diff --git a/outRun/.roku-deploy-staging/source/main.brs b/outRun/.roku-deploy-staging/source/main.brs index 1411f3f9..c7639c93 100644 --- a/outRun/.roku-deploy-staging/source/main.brs +++ b/outRun/.roku-deploy-staging/source/main.brs @@ -1,30 +1,30 @@ sub Main(args as dynamic) - if RBS_CC_1_reportLine(1, 2) and ((type(Rooibos__Init) = "Function")) then Rooibos__Init(SetupGlobals, "AddTestUtils", invalid, m) + if (type(Rooibos__Init) = "Function") then Rooibos__Init(SetupGlobals, "AddTestUtils", invalid, m) -RBS_CC_1_reportLine(3, 1): InitScreen() + InitScreen() end sub function InitScreen() as void 'this will be where you setup your typical roku app 'it will not be launched when running unit tests -RBS_CC_1_reportLine(9, 1): screen = CreateObject("roSGScreen") -RBS_CC_1_reportLine(10, 1): m.port = CreateObject("roMessagePort") -RBS_CC_1_reportLine(11, 1): screen.setMessagePort(m.port) + screen = CreateObject("roSGScreen") + m.port = CreateObject("roMessagePort") + screen.setMessagePort(m.port) -RBS_CC_1_reportLine(13, 1): rootScene = screen.CreateScene("TestsScene") -RBS_CC_1_reportLine(14, 1): rootScene.id = "ROOT" + rootScene = screen.CreateScene("TestsScene") + rootScene.id = "ROOT" -RBS_CC_1_reportLine(16, 1): screen.show() + screen.show() -RBS_CC_1_reportLine(18, 1): SetupGlobals(screen) + SetupGlobals(screen) -RBS_CC_1_reportLine(20, 1): while(true) -RBS_CC_1_reportLine(21, 1): msg = wait(0, m.port) -RBS_CC_1_reportLine(22, 1): msgType = type(msg) + while(true) + msg = wait(0, m.port) + msgType = type(msg) - if RBS_CC_1_reportLine(24, 2) and (msgType = "roSGScreenEvent") - if RBS_CC_1_reportLine(25, 2) and (msg.isScreenClosed()) -RBS_CC_1_reportLine(26, 1): return + if msgType = "roSGScreenEvent" + if msg.isScreenClosed() + return end if end if end while @@ -36,13 +36,13 @@ end function '** @param screen as roScreen - screen to set globals on '************************************************************* function SetupGlobals(screen) as void -RBS_CC_1_reportLine(38, 1): ? "SETTTING UP GLOBALS - do your standard setup stuff here" + ? "SETTTING UP GLOBALS - do your standard setup stuff here" -RBS_CC_1_reportLine(40, 1): m.global = screen.getGlobalNode() + m.global = screen.getGlobalNode() -RBS_CC_1_reportLine(42, 1): m.roDeviceInfo = CreateObject("roDeviceInfo") + m.roDeviceInfo = CreateObject("roDeviceInfo") -RBS_CC_1_reportLine(44, 1): m.displayInfo = { + m.displayInfo = { resolution: m.roDeviceInfo.GetUIResolution() displayType: m.roDeviceInfo.GetDisplayType() width: m.roDeviceInfo.GetDisplaySize().w @@ -51,34 +51,7 @@ RBS_CC_1_reportLine(44, 1): m.displayInfo = { hFactor: m.roDeviceInfo.GetDisplaySize().h/1080 } -RBS_CC_1_reportLine(53, 1): m.modelLocator = {"displayInfo":m.displayInfo} ' contrived example : this would be a specifc modelLocator node/other setup thing + m.modelLocator = {"displayInfo":m.displayInfo} ' contrived example : this would be a specifc modelLocator node/other setup thing -RBS_CC_1_reportLine(55, 1): m.global.addFields({"modelLocator": m.modelLocator}) -end function - - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_1_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"1", "l":stri(lineNumber), "r":reportType} - return true + m.global.addFields({"modelLocator": m.modelLocator}) end function diff --git a/outRun/.roku-deploy-staging/source/tests/AssertionTests.brs b/outRun/.roku-deploy-staging/source/tests/AssertionTests.brs index 65df2f69..6eba2846 100644 --- a/outRun/.roku-deploy-staging/source/tests/AssertionTests.brs +++ b/outRun/.roku-deploy-staging/source/tests/AssertionTests.brs @@ -7,13 +7,13 @@ '@Test Fail function Simp_basic_Fail() as void -RBS_CC_2_reportLine(9, 1): assertResult = m.Fail("reason") + assertResult = m.Fail("reason") -RBS_CC_2_reportLine(11, 1): isFail = m.currentResult.isFail -RBS_CC_2_reportLine(12, 1): m.currentResult.Reset() + isFail = m.currentResult.isFail + m.currentResult.Reset() -RBS_CC_2_reportLine(14, 1): m.AssertFalse(assertResult) -RBS_CC_2_reportLine(15, 1): m.AssertTrue(isFail) + m.AssertFalse(assertResult) + m.AssertTrue(isFail) end function '@Test AssertTrue @@ -25,12 +25,12 @@ end function '@Params["test", false] function Simp_basic_AssertTrue(value, expectedAssertResult) as void -RBS_CC_2_reportLine(27, 1): assertResult = m.AssertTrue(value) -RBS_CC_2_reportLine(28, 1): isFail = m.currentResult.isFail -RBS_CC_2_reportLine(29, 1): m.currentResult.Reset() + assertResult = m.AssertTrue(value) + isFail = m.currentResult.isFail + m.currentResult.Reset() -RBS_CC_2_reportLine(31, 1): m.AssertEqual(assertResult, expectedAssertResult) -RBS_CC_2_reportLine(32, 1): m.AssertEqual(isFail, not expectedAssertResult) + m.AssertEqual(assertResult, expectedAssertResult) + m.AssertEqual(isFail, not expectedAssertResult) end function '@Test AssertFalse @@ -42,13 +42,13 @@ end function '@Params["test", false] function Simp_basic_AssertFalse(value, expectedAssertResult) as void -RBS_CC_2_reportLine(44, 1): assertResult = m.AssertFalse(value) + assertResult = m.AssertFalse(value) -RBS_CC_2_reportLine(46, 1): isFail = m.currentResult.isFail -RBS_CC_2_reportLine(47, 1): m.currentResult.Reset() + isFail = m.currentResult.isFail + m.currentResult.Reset() -RBS_CC_2_reportLine(49, 1): m.AssertEqual(assertResult, expectedAssertResult) -RBS_CC_2_reportLine(50, 1): m.AssertEqual(isFail, not expectedAssertResult) + m.AssertEqual(assertResult, expectedAssertResult) + m.AssertEqual(isFail, not expectedAssertResult) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -74,13 +74,13 @@ end function '@Params[[{"one":1}, {"two":2}], [{"a":1}, {"a":1}, {"a":1}] ] function Simp_AssertArrayContainsAAs_Fail(expectedAAs, items) as void -RBS_CC_2_reportLine(76, 1): assertResult = m.AssertArrayContainsAAs(items, expectedAAs) + assertResult = m.AssertArrayContainsAAs(items, expectedAAs) -RBS_CC_2_reportLine(78, 1): isFail = m.currentResult.isFail -RBS_CC_2_reportLine(79, 1): m.currentResult.Reset() + isFail = m.currentResult.isFail + m.currentResult.Reset() -RBS_CC_2_reportLine(81, 1): m.AssertFalse(assertResult) -RBS_CC_2_reportLine(82, 1): m.AssertTrue(isFail) + m.AssertFalse(assertResult) + m.AssertTrue(isFail) end function @@ -94,13 +94,13 @@ end function '@Params[[{"one":1, "two":2}, {"one":1}, {"three":3}], [{"one":1}, {"three":3}, { "two":2, "one":1}]] function Simp_AssertArrayContainsAAs_Pass(expectedAAs, items) as void -RBS_CC_2_reportLine(96, 1): assertResult = m.AssertArrayContainsAAs(items, expectedAAs) + assertResult = m.AssertArrayContainsAAs(items, expectedAAs) -RBS_CC_2_reportLine(98, 1): isFail = m.currentResult.isFail + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(100, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(101, 1): m.AssertTrue(assertResult) -RBS_CC_2_reportLine(102, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertTrue(assertResult) + m.AssertFalse(isFail) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -109,24 +109,24 @@ end function '@BeforeEach function Simp_AssertGlobal_beforeEach() as void -RBS_CC_2_reportLine(111, 1): m.beforeEachGlobal = m.global + m.beforeEachGlobal = m.global end function '@AfterEach function Simp_AssertGlobal_afterEach() as void -RBS_CC_2_reportLine(116, 1): m.afterEachGlobal = m.global + m.afterEachGlobal = m.global end function '@Test global is in test function Simp_AssertGlobalIsPassedIntoTest() as void -RBS_CC_2_reportLine(121, 1): m.AssertNotInvalid(m.global) + m.AssertNotInvalid(m.global) end function '@Test global is in before each and after each function Simp_AssertGlobalIsPassedInto_beforeEach_and_afterEach() as void -RBS_CC_2_reportLine(126, 1): m.AssertNotInvalid(m.global) -RBS_CC_2_reportLine(127, 1): m.AssertNotInvalid(m.beforeEachGlobal) -RBS_CC_2_reportLine(128, 1): m.AssertNotInvalid(m.afterEachGlobal) + m.AssertNotInvalid(m.global) + m.AssertNotInvalid(m.beforeEachGlobal) + m.AssertNotInvalid(m.afterEachGlobal) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -141,12 +141,12 @@ end function '@Params[[{"test":1}, {"test":1}], "AssociativeArray"] function Simp_AssertArrayContainsOnlyValuesOfType_Pass(values, typeName) as void -RBS_CC_2_reportLine(143, 1): assertResult = m.AssertArrayContainsOnlyValuesOfType(values, typeName) -RBS_CC_2_reportLine(144, 1): isFail = m.currentResult.isFail + assertResult = m.AssertArrayContainsOnlyValuesOfType(values, typeName) + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(146, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(147, 1): m.AssertTrue(assertResult) -RBS_CC_2_reportLine(148, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertTrue(assertResult) + m.AssertFalse(isFail) end function @@ -164,14 +164,14 @@ end function '@Params[[{"test":1}, {"test":1}], "Array"] function Simp_AssertArrayContainsOnlyValuesOfType_Fail(values, typeName) as void -RBS_CC_2_reportLine(166, 1): assertResult = m.AssertArrayContainsOnlyValuesOfType(values, typeName) -RBS_CC_2_reportLine(167, 1): isFail = m.currentResult.isFail + assertResult = m.AssertArrayContainsOnlyValuesOfType(values, typeName) + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(169, 1): isFail = m.currentResult.isFail -RBS_CC_2_reportLine(170, 1): m.currentResult.Reset() + isFail = m.currentResult.isFail + m.currentResult.Reset() -RBS_CC_2_reportLine(172, 1): m.AssertFalse(assertResult) -RBS_CC_2_reportLine(173, 1): m.AssertTrue(isFail) + m.AssertFalse(assertResult) + m.AssertTrue(isFail) end function @@ -186,7 +186,7 @@ end function 'that we can have comments 'between functions and tags function Simp_whiteSpacing() as void -RBS_CC_2_reportLine(188, 1): m.AssertTrue(true) + m.AssertTrue(true) end function 'some comments to @@ -201,7 +201,7 @@ end function '@Params[4] function Simp_whiteSpacing_params(value) as void -RBS_CC_2_reportLine(203, 1): m.AssertTrue(true) + m.AssertTrue(true) end function @@ -224,8 +224,8 @@ end function '@Params[[3, 2, 1], [1, 2, 3], false] function Simp_EqArray_Pass(values, values2, expected) as void -RBS_CC_2_reportLine(226, 1): result = m.EqArray(values, values2) -RBS_CC_2_reportLine(227, 1): m.AssertEqual(result, expected) + result = m.EqArray(values, values2) + m.AssertEqual(result, expected) end function @@ -243,12 +243,12 @@ end function '@Params[[invalid]] function Simp_AssertNotEmpty_Pass(values) as void -RBS_CC_2_reportLine(245, 1): assertResult = m.AssertNotEmpty(values) -RBS_CC_2_reportLine(246, 1): isFail = m.currentResult.isFail + assertResult = m.AssertNotEmpty(values) + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(248, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(249, 1): m.AssertTrue(assertResult) -RBS_CC_2_reportLine(250, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertTrue(assertResult) + m.AssertFalse(isFail) end function @@ -260,12 +260,12 @@ end function '@Params[""] function Simp_AssertNotEmpty_Fail(values) as void -RBS_CC_2_reportLine(262, 1): assertResult = m.AssertNotEmpty(values) -RBS_CC_2_reportLine(263, 1): isFail = m.currentResult.isFail + assertResult = m.AssertNotEmpty(values) + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(265, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(266, 1): m.AssertFalse(assertResult) -RBS_CC_2_reportLine(267, 1): m.AssertTrue(isFail) + m.currentResult.Reset() + m.AssertFalse(assertResult) + m.AssertTrue(isFail) end function @@ -279,12 +279,12 @@ end function '@Params[""] function Simp_AssertEmpty_Pass(values) as void -RBS_CC_2_reportLine(281, 1): assertResult = m.AssertEmpty(values) -RBS_CC_2_reportLine(282, 1): isFail = m.currentResult.isFail + assertResult = m.AssertEmpty(values) + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(284, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(285, 1): m.AssertTrue(assertResult) -RBS_CC_2_reportLine(286, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertTrue(assertResult) + m.AssertFalse(isFail) end function @@ -300,12 +300,12 @@ end function '@Params[[invalid]] function Simp_AssertEmpty_Fail(values) as void -RBS_CC_2_reportLine(302, 1): assertResult = m.AssertEmpty(values) -RBS_CC_2_reportLine(303, 1): isFail = m.currentResult.isFail + assertResult = m.AssertEmpty(values) + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(305, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(306, 1): m.AssertFalse(assertResult) -RBS_CC_2_reportLine(307, 1): m.AssertTrue(isFail) + m.currentResult.Reset() + m.AssertFalse(assertResult) + m.AssertTrue(isFail) end function @@ -315,29 +315,29 @@ end function '@Test multi return values function Simp_expect_multiValues() -RBS_CC_2_reportLine(317, 1): obj = {} -RBS_CC_2_reportLine(318, 1): m.expect(obj, "mockMethod", 5, invalid, {"multiResult": ["one", 2, invalid, "last"]}, true) + obj = {} + m.expect(obj, "mockMethod", 5, invalid, {"multiResult": ["one", 2, invalid, "last"]}, true) -RBS_CC_2_reportLine(320, 1): result = obj.mockMethod() -RBS_CC_2_reportLine(321, 1): m.AssertEqual(result, "one") + result = obj.mockMethod() + m.AssertEqual(result, "one") -RBS_CC_2_reportLine(323, 1): result = obj.mockMethod() -RBS_CC_2_reportLine(324, 1): m.AssertEqual(result, 2) + result = obj.mockMethod() + m.AssertEqual(result, 2) -RBS_CC_2_reportLine(326, 1): result = obj.mockMethod() -RBS_CC_2_reportLine(327, 1): m.AssertEqual(result, invalid) + result = obj.mockMethod() + m.AssertEqual(result, invalid) -RBS_CC_2_reportLine(329, 1): result = obj.mockMethod() -RBS_CC_2_reportLine(330, 1): m.AssertEqual(result, "last") + result = obj.mockMethod() + m.AssertEqual(result, "last") -RBS_CC_2_reportLine(332, 1): result = obj.mockMethod() -RBS_CC_2_reportLine(333, 1): m.AssertEqual(result, "last") + result = obj.mockMethod() + m.AssertEqual(result, "last") -RBS_CC_2_reportLine(335, 1): m.assertMocks() -RBS_CC_2_reportLine(336, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(338, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(339, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertFalse(isFail) end function @@ -347,172 +347,172 @@ end function '@Test simple test function Simp_expect_multiExpect_success() -RBS_CC_2_reportLine(349, 1): obj = {} -RBS_CC_2_reportLine(350, 1): arg1 = "arg1" -RBS_CC_2_reportLine(351, 1): arg2 = "arg2" -RBS_CC_2_reportLine(352, 1): arg3 = "arg3" -RBS_CC_2_reportLine(353, 1): result1 = 1 -RBS_CC_2_reportLine(354, 1): result2 = 2 -RBS_CC_2_reportLine(355, 1): result3 = 3 + obj = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 -RBS_CC_2_reportLine(357, 1): m.expectOnce(obj, "mockMethod", [arg1], result1, true) -RBS_CC_2_reportLine(358, 1): m.expectOnce(obj, "mockMethod", [arg2], result2, true) -RBS_CC_2_reportLine(359, 1): m.expectOnce(obj, "mockMethod", [arg3], result3, true) + m.expectOnce(obj, "mockMethod", [arg1], result1, true) + m.expectOnce(obj, "mockMethod", [arg2], result2, true) + m.expectOnce(obj, "mockMethod", [arg3], result3, true) -RBS_CC_2_reportLine(361, 1): result = obj.mockMethod(arg1) -RBS_CC_2_reportLine(362, 1): m.AssertEqual(result, result1) + result = obj.mockMethod(arg1) + m.AssertEqual(result, result1) -RBS_CC_2_reportLine(364, 1): result = obj.mockMethod(arg2) -RBS_CC_2_reportLine(365, 1): m.AssertEqual(result, result2) + result = obj.mockMethod(arg2) + m.AssertEqual(result, result2) -RBS_CC_2_reportLine(367, 1): result = obj.mockMethod(arg3) -RBS_CC_2_reportLine(368, 1): m.AssertEqual(result, result3) + result = obj.mockMethod(arg3) + m.AssertEqual(result, result3) -RBS_CC_2_reportLine(370, 1): m.assertMocks() -RBS_CC_2_reportLine(371, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(373, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(374, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertFalse(isFail) end function '@Test can set up multi expects on same method - one invocation with any args function Simp_expect_multiExpect_success_oneCallsArgsNotTracked() -RBS_CC_2_reportLine(380, 1): obj = {} -RBS_CC_2_reportLine(381, 1): arg1 = "arg1" -RBS_CC_2_reportLine(382, 1): arg2 = "arg2" -RBS_CC_2_reportLine(383, 1): arg3 = "arg3" -RBS_CC_2_reportLine(384, 1): result1 = 1 -RBS_CC_2_reportLine(385, 1): result2 = 2 -RBS_CC_2_reportLine(386, 1): result3 = 3 + obj = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 -RBS_CC_2_reportLine(388, 1): m.expectOnce(obj, "mockMethod", [arg1], result1, true) -RBS_CC_2_reportLine(389, 1): m.expectOnce(obj, "mockMethod", invalid, result2, true) -RBS_CC_2_reportLine(390, 1): m.expectOnce(obj, "mockMethod", [arg3], result3, true) + m.expectOnce(obj, "mockMethod", [arg1], result1, true) + m.expectOnce(obj, "mockMethod", invalid, result2, true) + m.expectOnce(obj, "mockMethod", [arg3], result3, true) -RBS_CC_2_reportLine(392, 1): result = obj.mockMethod(arg1) -RBS_CC_2_reportLine(393, 1): m.AssertEqual(result, result1) + result = obj.mockMethod(arg1) + m.AssertEqual(result, result1) -RBS_CC_2_reportLine(395, 1): result = obj.mockMethod("do not care about args", "used in invocation", 2) -RBS_CC_2_reportLine(396, 1): m.AssertEqual(result, result2) + result = obj.mockMethod("do not care about args", "used in invocation", 2) + m.AssertEqual(result, result2) -RBS_CC_2_reportLine(398, 1): result = obj.mockMethod(arg3) -RBS_CC_2_reportLine(399, 1): m.AssertEqual(result, result3) + result = obj.mockMethod(arg3) + m.AssertEqual(result, result3) -RBS_CC_2_reportLine(401, 1): m.assertMocks() -RBS_CC_2_reportLine(402, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(404, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(405, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertFalse(isFail) end function '@Test can set up multi expects on same method - multi params function Simp_expect_multiExpect_multi_args_success() -RBS_CC_2_reportLine(411, 1): obj = {} -RBS_CC_2_reportLine(412, 1): arg1 = "arg1" -RBS_CC_2_reportLine(413, 1): arg2 = "arg2" -RBS_CC_2_reportLine(414, 1): arg3 = "arg3" -RBS_CC_2_reportLine(415, 1): result1 = 1 -RBS_CC_2_reportLine(416, 1): result2 = 2 -RBS_CC_2_reportLine(417, 1): result3 = 3 + obj = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 -RBS_CC_2_reportLine(419, 1): m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true) -RBS_CC_2_reportLine(420, 1): m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true) -RBS_CC_2_reportLine(421, 1): m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true) + m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true) + m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true) + m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true) -RBS_CC_2_reportLine(423, 1): result = obj.mockMethod(arg1, arg2, arg3) -RBS_CC_2_reportLine(424, 1): m.AssertEqual(result, result1) + result = obj.mockMethod(arg1, arg2, arg3) + m.AssertEqual(result, result1) -RBS_CC_2_reportLine(426, 1): result = obj.mockMethod(arg2, arg3, arg1) -RBS_CC_2_reportLine(427, 1): m.AssertEqual(result, result2) + result = obj.mockMethod(arg2, arg3, arg1) + m.AssertEqual(result, result2) -RBS_CC_2_reportLine(429, 1): result = obj.mockMethod(arg3, arg2, arg1) -RBS_CC_2_reportLine(430, 1): m.AssertEqual(result, result3) + result = obj.mockMethod(arg3, arg2, arg1) + m.AssertEqual(result, result3) -RBS_CC_2_reportLine(432, 1): m.assertMocks() -RBS_CC_2_reportLine(433, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(435, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(436, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertFalse(isFail) end function '@Test multi test, multi params with other expects function Simp_expect_multiExpect_multi_args_others_success() -RBS_CC_2_reportLine(442, 1): obj = {} -RBS_CC_2_reportLine(443, 1): arg1 = "arg1" -RBS_CC_2_reportLine(444, 1): arg2 = "arg2" -RBS_CC_2_reportLine(445, 1): arg3 = "arg3" -RBS_CC_2_reportLine(446, 1): result1 = 1 -RBS_CC_2_reportLine(447, 1): result2 = 2 -RBS_CC_2_reportLine(448, 1): result3 = 3 + obj = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 -RBS_CC_2_reportLine(450, 1): m.expectOnce(obj, "anotherMockMethod", invalid, "another", true) -RBS_CC_2_reportLine(451, 1): m.expectOnce(obj, "anotherMockMethod2", [1,2,3], "another2", true) -RBS_CC_2_reportLine(452, 1): m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true) -RBS_CC_2_reportLine(453, 1): m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true) -RBS_CC_2_reportLine(454, 1): m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true) + m.expectOnce(obj, "anotherMockMethod", invalid, "another", true) + m.expectOnce(obj, "anotherMockMethod2", [1,2,3], "another2", true) + m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true) + m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true) + m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true) -RBS_CC_2_reportLine(456, 1): result = obj.anotherMockMethod() -RBS_CC_2_reportLine(457, 1): m.AssertEqual(result, "another") + result = obj.anotherMockMethod() + m.AssertEqual(result, "another") -RBS_CC_2_reportLine(459, 1): result = obj.anotherMockMethod2(1, 2, 3) -RBS_CC_2_reportLine(460, 1): m.AssertEqual(result, "another2") + result = obj.anotherMockMethod2(1, 2, 3) + m.AssertEqual(result, "another2") -RBS_CC_2_reportLine(462, 1): result = obj.mockMethod(arg1, arg2, arg3) -RBS_CC_2_reportLine(463, 1): m.AssertEqual(result, result) + result = obj.mockMethod(arg1, arg2, arg3) + m.AssertEqual(result, result) -RBS_CC_2_reportLine(465, 1): result = obj.mockMethod(arg2, arg3, arg1) -RBS_CC_2_reportLine(466, 1): m.AssertEqual(result, result2) + result = obj.mockMethod(arg2, arg3, arg1) + m.AssertEqual(result, result2) -RBS_CC_2_reportLine(468, 1): result = obj.mockMethod(arg3, arg2, arg1) -RBS_CC_2_reportLine(469, 1): m.AssertEqual(result, result3) + result = obj.mockMethod(arg3, arg2, arg1) + m.AssertEqual(result, result3) -RBS_CC_2_reportLine(471, 1): m.assertMocks() -RBS_CC_2_reportLine(472, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(474, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(475, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertFalse(isFail) end function '@Test multi test, multi params with other expects - fail others function Simp_expect_multiExpect_multi_args_others_fail() -RBS_CC_2_reportLine(481, 1): obj = {} -RBS_CC_2_reportLine(482, 1): arg1 = "arg1" -RBS_CC_2_reportLine(483, 1): arg2 = "arg2" -RBS_CC_2_reportLine(484, 1): arg3 = "arg3" -RBS_CC_2_reportLine(485, 1): result1 = 1 -RBS_CC_2_reportLine(486, 1): result2 = 2 -RBS_CC_2_reportLine(487, 1): result3 = 3 + obj = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 -RBS_CC_2_reportLine(489, 1): m.expectOnce(obj, "anotherMockMethod", ["not passed"], "another", true) -RBS_CC_2_reportLine(490, 1): m.expectOnce(obj, "anotherMockMethod2", [1,2,3], "another2", true) -RBS_CC_2_reportLine(491, 1): m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true) -RBS_CC_2_reportLine(492, 1): m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true) -RBS_CC_2_reportLine(493, 1): m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true) + m.expectOnce(obj, "anotherMockMethod", ["not passed"], "another", true) + m.expectOnce(obj, "anotherMockMethod2", [1,2,3], "another2", true) + m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true) + m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true) + m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true) -RBS_CC_2_reportLine(495, 1): result = obj.anotherMockMethod() -RBS_CC_2_reportLine(496, 1): m.AssertEqual(result, "another") + result = obj.anotherMockMethod() + m.AssertEqual(result, "another") -RBS_CC_2_reportLine(498, 1): result = obj.anotherMockMethod2(1, 2, 3) -RBS_CC_2_reportLine(499, 1): m.AssertEqual(result, "another2") + result = obj.anotherMockMethod2(1, 2, 3) + m.AssertEqual(result, "another2") -RBS_CC_2_reportLine(501, 1): result = obj.mockMethod(arg1, arg2, arg3) -RBS_CC_2_reportLine(502, 1): m.AssertEqual(result, result) + result = obj.mockMethod(arg1, arg2, arg3) + m.AssertEqual(result, result) -RBS_CC_2_reportLine(504, 1): result = obj.mockMethod(arg2, arg3, arg1) -RBS_CC_2_reportLine(505, 1): m.AssertEqual(result, result2) + result = obj.mockMethod(arg2, arg3, arg1) + m.AssertEqual(result, result2) -RBS_CC_2_reportLine(507, 1): result = obj.mockMethod(arg3, arg2, arg1) -RBS_CC_2_reportLine(508, 1): m.AssertEqual(result, result3) + result = obj.mockMethod(arg3, arg2, arg1) + m.AssertEqual(result, result3) -RBS_CC_2_reportLine(510, 1): m.assertMocks() -RBS_CC_2_reportLine(511, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(513, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(514, 1): m.AssertTrue(isFail) + m.currentResult.Reset() + m.AssertTrue(isFail) end function @@ -524,32 +524,32 @@ end function '@Params["arg1_", "arg2_", "arg3"] '@Params["arg1_", invalid, "arg3"] function Simp_expect_multiExpect_fail(call1, call2, call3) -RBS_CC_2_reportLine(526, 1): obj = {} -RBS_CC_2_reportLine(527, 1): arg1 = "arg1" -RBS_CC_2_reportLine(528, 1): arg2 = "arg2" -RBS_CC_2_reportLine(529, 1): arg3 = "arg3" -RBS_CC_2_reportLine(530, 1): result1 = 1 -RBS_CC_2_reportLine(531, 1): result2 = 2 -RBS_CC_2_reportLine(532, 1): result3 = 3 + obj = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 -RBS_CC_2_reportLine(534, 1): m.expectOnce(obj, "mockMethod", [arg1], result1, true) -RBS_CC_2_reportLine(535, 1): m.expectOnce(obj, "mockMethod", [arg2], result2, true) -RBS_CC_2_reportLine(536, 1): m.expectOnce(obj, "mockMethod", [arg3], result3, true) + m.expectOnce(obj, "mockMethod", [arg1], result1, true) + m.expectOnce(obj, "mockMethod", [arg2], result2, true) + m.expectOnce(obj, "mockMethod", [arg3], result3, true) -RBS_CC_2_reportLine(538, 1): result = obj.mockMethod(call1) -RBS_CC_2_reportLine(539, 1): m.AssertEqual(result, result1) + result = obj.mockMethod(call1) + m.AssertEqual(result, result1) -RBS_CC_2_reportLine(541, 1): result = obj.mockMethod(call2) -RBS_CC_2_reportLine(542, 1): m.AssertEqual(result, result2) + result = obj.mockMethod(call2) + m.AssertEqual(result, result2) -RBS_CC_2_reportLine(544, 1): result = obj.mockMethod(call2) -RBS_CC_2_reportLine(545, 1): m.AssertEqual(result, result3) + result = obj.mockMethod(call2) + m.AssertEqual(result, result3) -RBS_CC_2_reportLine(547, 1): m.assertMocks() -RBS_CC_2_reportLine(548, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(550, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(551, 1): m.AssertTrue(isFail) + m.currentResult.Reset() + m.AssertTrue(isFail) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -558,65 +558,65 @@ end function '@Test success function Simp_expect_multiExpect_differentOnj_success() -RBS_CC_2_reportLine(560, 1): obj = {} -RBS_CC_2_reportLine(561, 1): obj2 = {} -RBS_CC_2_reportLine(562, 1): arg1 = "arg1" -RBS_CC_2_reportLine(563, 1): arg2 = "arg2" -RBS_CC_2_reportLine(564, 1): arg3 = "arg3" -RBS_CC_2_reportLine(565, 1): result1 = 1 -RBS_CC_2_reportLine(566, 1): result2 = 2 -RBS_CC_2_reportLine(567, 1): result3 = 3 + obj = {} + obj2 = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 -RBS_CC_2_reportLine(569, 1): m.expectOnce(obj, "mockMethod", [arg1], result1, true) -RBS_CC_2_reportLine(570, 1): m.expectOnce(obj, "mockMethod", [arg2], result2, true) -RBS_CC_2_reportLine(571, 1): m.expectOnce(obj2, "mockMethod", [arg3], result3, true) + m.expectOnce(obj, "mockMethod", [arg1], result1, true) + m.expectOnce(obj, "mockMethod", [arg2], result2, true) + m.expectOnce(obj2, "mockMethod", [arg3], result3, true) -RBS_CC_2_reportLine(573, 1): result = obj.mockMethod(arg1) -RBS_CC_2_reportLine(574, 1): m.AssertEqual(result, result1) + result = obj.mockMethod(arg1) + m.AssertEqual(result, result1) -RBS_CC_2_reportLine(576, 1): result = obj.mockMethod(arg2) -RBS_CC_2_reportLine(577, 1): m.AssertEqual(result, result2) + result = obj.mockMethod(arg2) + m.AssertEqual(result, result2) -RBS_CC_2_reportLine(579, 1): result = obj2.mockMethod(arg3) -RBS_CC_2_reportLine(580, 1): m.AssertEqual(result, result3) + result = obj2.mockMethod(arg3) + m.AssertEqual(result, result3) -RBS_CC_2_reportLine(582, 1): m.assertMocks() -RBS_CC_2_reportLine(583, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(585, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(586, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertFalse(isFail) end function '@Test fail to match function Simp_expect_multiExpect_differentOnj_fail() -RBS_CC_2_reportLine(592, 1): obj = {} -RBS_CC_2_reportLine(593, 1): obj2 = {} -RBS_CC_2_reportLine(594, 1): arg1 = "arg1" -RBS_CC_2_reportLine(595, 1): arg2 = "arg2" -RBS_CC_2_reportLine(596, 1): arg3 = "arg3" -RBS_CC_2_reportLine(597, 1): result1 = 1 -RBS_CC_2_reportLine(598, 1): result2 = 2 -RBS_CC_2_reportLine(599, 1): result3 = 3 + obj = {} + obj2 = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 -RBS_CC_2_reportLine(601, 1): m.expectOnce(obj, "mockMethod", [arg1], result1, true) -RBS_CC_2_reportLine(602, 1): m.expectOnce(obj, "mockMethod", [arg2], result2, true) -RBS_CC_2_reportLine(603, 1): m.expectOnce(obj2, "mockMethod", [arg3], result3, true) + m.expectOnce(obj, "mockMethod", [arg1], result1, true) + m.expectOnce(obj, "mockMethod", [arg2], result2, true) + m.expectOnce(obj2, "mockMethod", [arg3], result3, true) -RBS_CC_2_reportLine(605, 1): result = obj.mockMethod(arg1) -RBS_CC_2_reportLine(606, 1): m.AssertEqual(result, result1) + result = obj.mockMethod(arg1) + m.AssertEqual(result, result1) -RBS_CC_2_reportLine(608, 1): result = obj.mockMethod(arg2) -RBS_CC_2_reportLine(609, 1): m.AssertEqual(result, result2) + result = obj.mockMethod(arg2) + m.AssertEqual(result, result2) -RBS_CC_2_reportLine(611, 1): result = obj2.mockMethod(arg3) -RBS_CC_2_reportLine(612, 1): m.AssertEqual(result, result3) + result = obj2.mockMethod(arg3) + m.AssertEqual(result, result3) -RBS_CC_2_reportLine(614, 1): m.assertMocks() -RBS_CC_2_reportLine(615, 1): isFail = m.currentResult.isFail + m.assertMocks() + isFail = m.currentResult.isFail -RBS_CC_2_reportLine(617, 1): m.currentResult.Reset() -RBS_CC_2_reportLine(618, 1): m.AssertFalse(isFail) + m.currentResult.Reset() + m.AssertFalse(isFail) end function @@ -657,30 +657,4 @@ end function ' ' 'Mocking and stubbing ' AssertMocks -' MockFail - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_2_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"2", "l":stri(lineNumber), "r":reportType} - return true -end function +' MockFail \ No newline at end of file diff --git a/outRun/.roku-deploy-staging/source/tests/ExpectTests.brs b/outRun/.roku-deploy-staging/source/tests/ExpectTests.brs index 91354e04..114ce322 100644 --- a/outRun/.roku-deploy-staging/source/tests/ExpectTests.brs +++ b/outRun/.roku-deploy-staging/source/tests/ExpectTests.brs @@ -11,45 +11,18 @@ '@Params[["42"], true] '@Params[[42], false] function ET_expectOnce_valuesBug_reported(expectedValue, expectMockFail) as void -RBS_CC_4_reportLine(13, 1): obj = { + obj = { foo: function(arg0) : return arg0 : end function } -RBS_CC_4_reportLine(17, 1): m.ExpectOnce(obj, "foo", expectedValue) -RBS_CC_4_reportLine(18, 1): obj.foo(42) -RBS_CC_4_reportLine(19, 1): m.isAutoAssertingMocks = false -RBS_CC_4_reportLine(20, 1): m.AssertMocks() + m.ExpectOnce(obj, "foo", expectedValue) + obj.foo(42) + m.isAutoAssertingMocks = false + m.AssertMocks() -RBS_CC_4_reportLine(22, 1): isFail = m.currentResult.isFail -RBS_CC_4_reportLine(23, 1): m.currentResult.Reset() -RBS_CC_4_reportLine(24, 1): m.CleanMocks() -RBS_CC_4_reportLine(25, 1): m.AssertEqual(isFail, expectMockFail) + isFail = m.currentResult.isFail + m.currentResult.Reset() + m.CleanMocks() + m.AssertEqual(isFail, expectMockFail) end function - - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_4_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"4", "l":stri(lineNumber), "r":reportType} - return true -end function diff --git a/outRun/.roku-deploy-staging/source/tests/ParamsTests.brs b/outRun/.roku-deploy-staging/source/tests/ParamsTests.brs index ff4d9921..a7ebed10 100644 --- a/outRun/.roku-deploy-staging/source/tests/ParamsTests.brs +++ b/outRun/.roku-deploy-staging/source/tests/ParamsTests.brs @@ -9,7 +9,7 @@ '@Params["#RBSNode|Group", "Group"] '@Params["#RBSNode|Label", "Label"] function PT_RBSNodeDirective(node, expectedNodeType) as void -RBS_CC_8_reportLine(11, 1): m.assertSubType(node, expectedNodeType) + m.assertSubType(node, expectedNodeType) end function '@Test node parsed as other arg index @@ -17,10 +17,10 @@ end function '@Params[1, 2, 3, "#RBSNode|Group", "Group"] '@Params[1, 2, 3, "#RBSNode|Label", "Label"] function PT_RBSNodeDirective_otherArgs(arg1, arg2, arg3, node, expectedNodeType) as void -RBS_CC_8_reportLine(19, 1): m.assertSubType(node, expectedNodeType) -RBS_CC_8_reportLine(20, 1): m.assertEqual(arg1, 1) -RBS_CC_8_reportLine(21, 1): m.assertEqual(arg2, 2) -RBS_CC_8_reportLine(22, 1): m.assertEqual(arg3, 3) + m.assertSubType(node, expectedNodeType) + m.assertEqual(arg1, 1) + m.assertEqual(arg2, 2) + m.assertEqual(arg3, 3) end function '@Test does not affect regular params @@ -28,31 +28,5 @@ end function '@Params[22, 22] '@Params[[1,2,3], [1,2,3]] function PT_RBSNodeDirective_noSideEffect(arg1, expectedValue) as void -RBS_CC_8_reportLine(30, 1): m.assertEqual(arg1, expectedValue) -end function - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_8_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"8", "l":stri(lineNumber), "r":reportType} - return true -end function + m.assertEqual(arg1, expectedValue) +end function \ No newline at end of file diff --git a/outRun/.roku-deploy-staging/source/tests/issue_13_afterEach_not_running.brs b/outRun/.roku-deploy-staging/source/tests/issue_13_afterEach_not_running.brs index c7efa39b..228c7df5 100644 --- a/outRun/.roku-deploy-staging/source/tests/issue_13_afterEach_not_running.brs +++ b/outRun/.roku-deploy-staging/source/tests/issue_13_afterEach_not_running.brs @@ -6,7 +6,7 @@ '@Test simple function DGNT_group1_test() -RBS_CC_5_reportLine(8, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -15,7 +15,7 @@ end function '@Test simple function DGNT_group2_test() -RBS_CC_5_reportLine(17, 1): m.AssertTrue(true) + m.AssertTrue(true) end function @@ -25,7 +25,7 @@ end function '@Test simple function DGNT_group2_dupe_test() -RBS_CC_5_reportLine(27, 1): m.AssertTrue(true) + m.AssertTrue(true) end function @@ -35,7 +35,7 @@ end function '@Test simple function DGNT_group3_test() -RBS_CC_5_reportLine(37, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -44,31 +44,5 @@ end function '@Test simple function DGNT_group1_dupe_test() -RBS_CC_5_reportLine(46, 1): m.AssertTrue(true) -end function - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_5_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"5", "l":stri(lineNumber), "r":reportType} - return true -end function + m.AssertTrue(true) +end function \ No newline at end of file diff --git a/outRun/.roku-deploy-staging/source/tests/issue_15_tests_only_on_groups.brs b/outRun/.roku-deploy-staging/source/tests/issue_15_tests_only_on_groups.brs index 63ece7fd..67b33e76 100644 --- a/outRun/.roku-deploy-staging/source/tests/issue_15_tests_only_on_groups.brs +++ b/outRun/.roku-deploy-staging/source/tests/issue_15_tests_only_on_groups.brs @@ -7,7 +7,7 @@ '@Test it one function RBSA__it_test_one() as void -RBS_CC_6_reportLine(9, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -16,7 +16,7 @@ end function '@Test it two function RBSA__it_test_two() as void -RBS_CC_6_reportLine(18, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -26,31 +26,5 @@ end function '@Test it three function RBSA__it_test_three() as void -RBS_CC_6_reportLine(28, 1): m.AssertTrue(true) -end function - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_6_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"6", "l":stri(lineNumber), "r":reportType} - return true -end function + m.AssertTrue(true) +end function \ No newline at end of file diff --git a/outRun/.roku-deploy-staging/source/tests/issue_5_duplicateGroupNames.brs b/outRun/.roku-deploy-staging/source/tests/issue_5_duplicateGroupNames.brs index 67a70818..1725a4bb 100644 --- a/outRun/.roku-deploy-staging/source/tests/issue_5_duplicateGroupNames.brs +++ b/outRun/.roku-deploy-staging/source/tests/issue_5_duplicateGroupNames.brs @@ -6,49 +6,23 @@ '@BeforeEach function RBSA__BeforeEach() as void -RBS_CC_7_reportLine(8, 1): ? "!!! Before" + ? "!!! Before" end function '@AfterEach function RBSA__AfterEach() as void -RBS_CC_7_reportLine(14, 1): ? "!!! After" + ? "!!! After" end function '@Test before after function RBSA__before_after() as void -RBS_CC_7_reportLine(20, 1): assertResult = m.Fail("reason") + assertResult = m.Fail("reason") -RBS_CC_7_reportLine(22, 1): isFail = m.currentResult.isFail -RBS_CC_7_reportLine(23, 1): m.currentResult.Reset() + isFail = m.currentResult.isFail + m.currentResult.Reset() -RBS_CC_7_reportLine(25, 1): m.AssertFalse(assertResult) -RBS_CC_7_reportLine(26, 1): m.AssertTrue(isFail) -end function - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_7_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"7", "l":stri(lineNumber), "r":reportType} - return true -end function + m.AssertFalse(assertResult) + m.AssertTrue(isFail) +end function \ No newline at end of file diff --git a/outRun/.roku-deploy-staging/source/tests/testUtils.brs b/outRun/.roku-deploy-staging/source/tests/testUtils.brs index cf5beac5..54d2476d 100644 --- a/outRun/.roku-deploy-staging/source/tests/testUtils.brs +++ b/outRun/.roku-deploy-staging/source/tests/testUtils.brs @@ -5,30 +5,4 @@ sub AddTestUtils(testCase) 'e.g. 'testCase.testUtils = TestUtils() 'testCase.r = rodash() -end sub - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_9_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"9", "l":stri(lineNumber), "r":reportType} - return true -end function +end sub \ No newline at end of file diff --git a/outRun/.roku-deploy-staging/source/tests/verifyBeforeEachAfterEach.brs b/outRun/.roku-deploy-staging/source/tests/verifyBeforeEachAfterEach.brs index bf6ce8b5..5bfae93e 100644 --- a/outRun/.roku-deploy-staging/source/tests/verifyBeforeEachAfterEach.brs +++ b/outRun/.roku-deploy-staging/source/tests/verifyBeforeEachAfterEach.brs @@ -2,24 +2,24 @@ '@Setup function BEAER_Setup() as void -RBS_CC_10_reportLine(4, 1): ? "!!! Setup" + ? "!!! Setup" end function '@TearDown function BEAER_TearDown() as void -RBS_CC_10_reportLine(10, 1): ? "!!! TearDown" + ? "!!! TearDown" end function '@BeforeEach function BEAER_BeforeEach() as void -RBS_CC_10_reportLine(15, 1): ? "!!! Before" + ? "!!! Before" end function '@AfterEach function BEAER_AfterEach() as void -RBS_CC_10_reportLine(21, 1): ? "!!! After" + ? "!!! After" end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -28,12 +28,12 @@ end function '@Test 1 function BEAER_group1_1() as void -RBS_CC_10_reportLine(30, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '@Test 2 function BEAER_group1_2() as void -RBS_CC_10_reportLine(35, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '@Test 3 @@ -41,7 +41,7 @@ end function '@Params["b"] '@Params["c"] function BEAER_group1_3(values) as void -RBS_CC_10_reportLine(43, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -50,23 +50,23 @@ end function '@BeforeEach function BEAER_group2_BeforeEach() as void -RBS_CC_10_reportLine(52, 1): ? "!!! Before GROUP 2" + ? "!!! Before GROUP 2" end function '@AfterEach function BEAER_group2_AfterEach() as void -RBS_CC_10_reportLine(58, 1): ? "!!! After GROUP 2" + ? "!!! After GROUP 2" end function '@Test 1 function BEAER_group2_1() as void -RBS_CC_10_reportLine(63, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '@Test 2 function BEAER_group2_2() as void -RBS_CC_10_reportLine(68, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '@Test 3 @@ -74,7 +74,7 @@ end function '@Params["b"] '@Params["c"] function BEAER_group2_3(values) as void -RBS_CC_10_reportLine(76, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -83,12 +83,12 @@ end function '@Test 1 function BEAER_group3_1() as void -RBS_CC_10_reportLine(85, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '@Test 2 function BEAER_group3_2() as void -RBS_CC_10_reportLine(90, 1): m.AssertTrue(true) + m.AssertTrue(true) end function '@Test 3 @@ -96,31 +96,5 @@ end function '@Params["b"] '@Params["c"] function BEAER_group3_3(values) as void -RBS_CC_10_reportLine(98, 1): m.AssertTrue(true) -end function - - -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -'++ rooibos code coverage util functions DO NOT MODIFY -'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -function RBS_CC_10_reportLine(lineNumber, reportType = 1) - if m.global = invalid - '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)" - return true - else - if m._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - if m.global._rbs_ccn = invalid - '? "Coverage maps are not created - creating now" - m.global.addFields({ - "_rbs_ccn": createObject("roSGnode", "CodeCoverage") - }) - end if - m._rbs_ccn = m.global._rbs_ccn - end if - end if - - m._rbs_ccn.entry = {"f":"10", "l":stri(lineNumber), "r":reportType} - return true -end function + m.AssertTrue(true) +end function \ No newline at end of file diff --git a/package.json b/package.json index f9855728..2991bd34 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "jsdoc": "3.5.5", "minami": "^1.2.3", "roku-deploy": "^2.0.0", - "rooibos-preprocessor": "^3.0.4-beta", + "rooibos-preprocessor": "^3.0.6-beta", "typescript": "^3.3.1", "vinyl-paths": "^2.1.0" }, diff --git a/samples/example/source/tests/rooibos/rooibosDist.brs b/samples/example/source/tests/rooibos/rooibosDist.brs index 482833ff..0b12f640 100644 --- a/samples/example/source/tests/rooibos/rooibosDist.brs +++ b/samples/example/source/tests/rooibos/rooibosDist.brs @@ -1810,7 +1810,7 @@ sub RBS_LOGGER_PrintTestStatistic(testCase as object) testChar = "|" locationLine = StrI(metaTestCase.lineNumber).trim() end if - locationText = testCase.filePath.trim() + "(" + locationLine + ")" + locationText = "pkg:/" + testCase.filePath.trim() + "(" + locationLine + ")" insetText = "" if (metaTestcase.isParamTest <> true) messageLine = RBS_LOGGER_FillText(" " + testChar + " |--" + metaTestCase.Name + " : ", ".", 80) @@ -1864,7 +1864,7 @@ sub RBS_LOGGER_PrintSuiteSetUp(sName as string) end if end sub sub RBS_LOGGER_PrintMetaSuiteStart(metaTestSuite) - ? metaTestSuite.name; " (" ; metaTestSuite.filePath + "(1))" + ? metaTestSuite.name; " " ; "pkg:/" ; metaTestSuite.filePath + "(1)" end sub sub RBS_LOGGER_PrintSuiteStart(sName as string) ? " |-" ; sName diff --git a/src/Rooibos_TestLogger.brs b/src/Rooibos_TestLogger.brs index 2ec36b43..b568a9a1 100644 --- a/src/Rooibos_TestLogger.brs +++ b/src/Rooibos_TestLogger.brs @@ -94,7 +94,7 @@ sub RBS_LOGGER_PrintTestStatistic(testCase as object) testChar = "|" locationLine = StrI(metaTestCase.lineNumber).trim() end if - locationText = testCase.filePath.trim() + "(" + locationLine + ")" + locationText = "pkg:/" + testCase.filePath.trim() + "(" + locationLine + ")" insetText = "" if (metaTestcase.isParamTest <> true) @@ -169,7 +169,7 @@ end sub '---------------------------------------------------------------- sub RBS_LOGGER_PrintMetaSuiteStart(metaTestSuite) - ? metaTestSuite.name; " (" ; metaTestSuite.filePath + "(1))" + ? metaTestSuite.name; " " ; "pkg:/" ; metaTestSuite.filePath + "(1)" end sub '----------------------------------------------------------------