From b1a3b57aba440bcba96108d0cb5e18574cb07811 Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Mon, 20 Jan 2025 16:27:45 -0400 Subject: [PATCH 1/6] Update bsc-plugin/src/lib/rooibos/CodeCoverageProcessor.spec.ts --- bsc-plugin/src/lib/rooibos/CodeCoverageProcessor.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsc-plugin/src/lib/rooibos/CodeCoverageProcessor.spec.ts b/bsc-plugin/src/lib/rooibos/CodeCoverageProcessor.spec.ts index dcfcad61..19bce2e5 100644 --- a/bsc-plugin/src/lib/rooibos/CodeCoverageProcessor.spec.ts +++ b/bsc-plugin/src/lib/rooibos/CodeCoverageProcessor.spec.ts @@ -333,7 +333,7 @@ describe('RooibosPlugin', () => { expect(a).to.equal(b); }); - it.skip('correctly transpiles some statements', async () => { + it('correctly transpiles some statements', async () => { const source = `sub foo() x = function(y) if (true) then From 6b91e29a974ab7e847a8b303913ba3d63364b253 Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Mon, 20 Jan 2025 16:47:14 -0400 Subject: [PATCH 2/6] New line when tests start --- framework/src/source/rooibos/Rooibos.bs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/src/source/rooibos/Rooibos.bs b/framework/src/source/rooibos/Rooibos.bs index 17b3c81d..09890319 100644 --- a/framework/src/source/rooibos/Rooibos.bs +++ b/framework/src/source/rooibos/Rooibos.bs @@ -29,6 +29,7 @@ namespace rooibos else rooibos.common.logInfo("scene is ready; running tests now") + print "" runner = new rooibos.TestRunner(scene, m) runner.Run() @@ -54,6 +55,7 @@ namespace rooibos if msg.getField() = "isReadyToStartTests" and msg.getData() = true rooibos.common.logInfo("scene is ready; running tests now") + print "" runner = new rooibos.TestRunner(scene, m) runner.Run() end if From 1c7063e894d2bf0e3ecfde058ce5eced46c72e51 Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Wed, 22 Jan 2025 10:07:26 -0400 Subject: [PATCH 3/6] Added assertNotInvalid test for roInvalid --- tests/src/source/FailedAssertion.spec.bs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/src/source/FailedAssertion.spec.bs b/tests/src/source/FailedAssertion.spec.bs index adc99bd5..3e38bf37 100644 --- a/tests/src/source/FailedAssertion.spec.bs +++ b/tests/src/source/FailedAssertion.spec.bs @@ -944,6 +944,11 @@ namespace tests m.assertNotInvalid(invalid) end function + @it("failed assertInvalid on roInvalid object equivalent for intrinsic type 'Invalid'") + function _() + m.assertNotInvalid(createObject("roInvalid")) + end function + '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @describe("tests AssertAAHasKey fail") '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ From cba39ca33c961c5464483f847c2bc82449eacfd2 Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Wed, 22 Jan 2025 10:08:08 -0400 Subject: [PATCH 4/6] Updated assertInvalid test for roInvalid --- tests/src/source/Assertion.spec.bs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/src/source/Assertion.spec.bs b/tests/src/source/Assertion.spec.bs index 38e8a160..507210be 100644 --- a/tests/src/source/Assertion.spec.bs +++ b/tests/src/source/Assertion.spec.bs @@ -682,10 +682,9 @@ namespace tests m.assertInvalid(invalid) end function - @it("passes roInvalid from parseJson") + @it("passes roInvalid object equivalent for intrinsic type 'Invalid'") function _() - result = parseJson(formatJson({ a: 1, b: "test", c: createObject("roTimespan") })) - m.assertInvalid(result) + m.assertInvalid(createObject("roInvalid")) end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ From b5506e6af441b0a31d853d8d6df3906cf2e4a274 Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Wed, 22 Jan 2025 10:08:51 -0400 Subject: [PATCH 5/6] hardened assertNotInvalid and fixed assertInvalid for roInvalid --- framework/src/source/rooibos/BaseTestSuite.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/source/rooibos/BaseTestSuite.bs b/framework/src/source/rooibos/BaseTestSuite.bs index 7caf2645..6db66780 100644 --- a/framework/src/source/rooibos/BaseTestSuite.bs +++ b/framework/src/source/rooibos/BaseTestSuite.bs @@ -541,7 +541,7 @@ namespace rooibos end if try - if type(value) <> "Invalid" + if rooibos.common.getSafeType(value) <> "Invalid" if msg = "" actual = rooibos.common.asMultilineString(value, true) msg = `expected "${rooibos.common.truncateString(actual)}" to be invalid` @@ -573,7 +573,7 @@ namespace rooibos return false end if try - if value = invalid + if rooibos.common.getSafeType(value) = "Invalid" if msg = "" actual = rooibos.common.asMultilineString(value, true) msg = `expected "${rooibos.common.truncateString(actual)}" to not be invalid` From e5f43b4106aae6d39ac86bd293504c8f14cdcc05 Mon Sep 17 00:00:00 2001 From: Christopher Dwyer-Perkins Date: Wed, 22 Jan 2025 11:43:14 -0400 Subject: [PATCH 6/6] Fixed some off by oneline number reporting bugs --- bsc-plugin/src/lib/rooibos/TestCase.ts | 12 +- bsc-plugin/src/lib/rooibos/TestGroup.ts | 4 +- bsc-plugin/src/plugin.spec.ts | 131 +++++++++--------- .../src/source/rooibos/ConsoleTestReporter.bs | 4 +- .../src/source/rooibos/MochaTestReporter.bs | 14 +- 5 files changed, 82 insertions(+), 83 deletions(-) diff --git a/bsc-plugin/src/lib/rooibos/TestCase.ts b/bsc-plugin/src/lib/rooibos/TestCase.ts index 113bb7bd..076102a0 100644 --- a/bsc-plugin/src/lib/rooibos/TestCase.ts +++ b/bsc-plugin/src/lib/rooibos/TestCase.ts @@ -15,7 +15,6 @@ export class TestCase { this.lineNumber = lineNumber; this.paramLineNumber = paramLineNumber; this.assertIndex = 0; - this.assertLineNumberMap = {}; this.rawParams = params; this.expectedNumberOfParams = expectedNumberOfParams; this.paramTestIndex = paramTestIndex; @@ -37,7 +36,6 @@ export class TestCase { public paramLineNumber: number; public assertIndex: number; public expectedNumberOfParams: number; - public assertLineNumberMap: any; public rawParams: any[]; public paramTestIndex: number; @@ -55,10 +53,9 @@ export class TestCase { slow: ${this.slow} isParamTest: ${this.isParamTest} name: ${sanitizeBsJsonString(this.name)} - lineNumber: ${this.lineNumber + 2} - paramLineNumber: ${this.paramLineNumber} + lineNumber: ${this.lineNumber + 1} + paramLineNumber: ${this.isParamTest ? this.paramLineNumber + 1 : 0} assertIndex: ${this.assertIndex} - assertLineNumberMap: ${JSON.stringify(this.assertLineNumberMap)} rawParams: ${rawParamsText} paramTestIndex: ${this.paramTestIndex} expectedNumberOfParams: ${this.expectedNumberOfParams} @@ -66,11 +63,6 @@ export class TestCase { }`; } - public addAssertLine(lineNumber: number) { - this.assertLineNumberMap[this.assertIndex.toString().trim()] = lineNumber; - this.assertIndex++; - } - fixBadJson(o) { // In case of an array we'll stringify all objects. if (Array.isArray(o)) { diff --git a/bsc-plugin/src/lib/rooibos/TestGroup.ts b/bsc-plugin/src/lib/rooibos/TestGroup.ts index 1d7f9cce..ee4e9ce2 100644 --- a/bsc-plugin/src/lib/rooibos/TestGroup.ts +++ b/bsc-plugin/src/lib/rooibos/TestGroup.ts @@ -79,7 +79,7 @@ export class TestGroup extends TestBlock { const trailingLine = Parser.parse(`if m.currentResult?.isFail = true then m.done() : return ${isSub ? '' : 'invalid'}`).ast.statements[0]; editor.arraySplice(owner, key + 1, 0, trailingLine); } - const leadingLine = Parser.parse(`m.currentAssertLineNumber = ${callExpression.range.start.line}`).ast.statements[0]; + const leadingLine = Parser.parse(`m.currentAssertLineNumber = ${callExpression.range.start.line + 1}`).ast.statements[0]; editor.arraySplice(owner, key, 0, leadingLine); } } @@ -221,7 +221,7 @@ export class TestGroup extends TestBlock { isSolo: ${this.isSolo} isIgnored: ${this.isIgnored} filename: "${this.pkgPath}" - lineNumber: "${this.annotation.annotation.range.start.line}" + lineNumber: "${this.annotation.annotation.range.start.line + 1}" setupFunctionName: "${this.setupFunctionName || ''}" tearDownFunctionName: "${this.tearDownFunctionName || ''}" beforeEachFunctionName: "${this.beforeEachFunctionName || ''}" diff --git a/bsc-plugin/src/plugin.spec.ts b/bsc-plugin/src/plugin.spec.ts index 43f11d8f..2da0898b 100644 --- a/bsc-plugin/src/plugin.spec.ts +++ b/bsc-plugin/src/plugin.spec.ts @@ -511,7 +511,7 @@ describe('RooibosPlugin', () => { isSolo: false isIgnored: false filename: "${s`source/test.spec.bs`}" - lineNumber: "3" + lineNumber: "4" setupFunctionName: "" tearDownFunctionName: "" beforeEachFunctionName: "" @@ -527,10 +527,9 @@ describe('RooibosPlugin', () => { slow: 1000 isParamTest: false name: "is test1" - lineNumber: 8 + lineNumber: 7 paramLineNumber: 0 assertIndex: 0 - assertLineNumberMap: {} rawParams: invalid paramTestIndex: 0 expectedNumberOfParams: 0 @@ -670,7 +669,7 @@ describe('RooibosPlugin', () => { expect( testContents ).to.eql(undent` - m.currentAssertLineNumber = 6 + m.currentAssertLineNumber = 7 m._expectCalled(m.thing, "callFunc", m, "m.thing", [ "getFunction" ]) @@ -678,7 +677,7 @@ describe('RooibosPlugin', () => { m.done() return invalid end if - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectCalled(m.thing, "callFunc", m, "m.thing", [ "getFunction" ], "return") @@ -686,7 +685,7 @@ describe('RooibosPlugin', () => { m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectCalled(m.thing, "callFunc", m, "m.thing", [ "getFunction" "a" @@ -696,7 +695,7 @@ describe('RooibosPlugin', () => { m.done() return invalid end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectCalled(m.thing, "callFunc", m, "m.thing", [ "getFunction" "a" @@ -728,13 +727,13 @@ describe('RooibosPlugin', () => { expect( getTestFunctionContents() ).to.eql(undent` - m.currentAssertLineNumber = 6 + m.currentAssertLineNumber = 7 m._expectCalled(m.thing, "getFunctionField", m, "m.thing", invalid) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectCalled(m.thing, "getFunctionField", m, "m.thing", invalid, "return") if m.currentResult?.isFail = true then m.done() @@ -765,19 +764,19 @@ describe('RooibosPlugin', () => { expect( testContents ).to.eql(undent` - m.currentAssertLineNumber = 6 + m.currentAssertLineNumber = 7 m._expectCalled(m.thing, "getFunction", m, "m.thing", []) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectCalled(m.thing, "getFunction", m, "m.thing", [], "return") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectCalled(m.thing, "getFunction", m, "m.thing", [ "arg1" "arg2" @@ -786,7 +785,7 @@ describe('RooibosPlugin', () => { m.done() return invalid end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectCalled(m.thing, "getFunction", m, "m.thing", [ "arg1" "arg2" @@ -818,19 +817,19 @@ describe('RooibosPlugin', () => { expect( getTestSubContents() ).to.eql(undent` - m.currentAssertLineNumber = 6 + m.currentAssertLineNumber = 7 m._expectCalled(m.thing, "getFunction", m, "m.thing", []) if m.currentResult?.isFail = true then m.done() return end if - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectCalled(m.thing, "getFunction", m, "m.thing", [], "return") if m.currentResult?.isFail = true then m.done() return end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectCalled(m.thing, "getFunction", m, "m.thing", [ "arg1" "arg2" @@ -839,7 +838,7 @@ describe('RooibosPlugin', () => { m.done() return end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectCalled(m.thing, "getFunction", m, "m.thing", [ "arg1" "arg2" @@ -873,19 +872,19 @@ describe('RooibosPlugin', () => { expect( testContents ).to.eql(undent` - m.currentAssertLineNumber = 6 + m.currentAssertLineNumber = 7 m._expectCalled(m.thing, "getFunction", m, "m.thing", []) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectCalled(m.thing, "getFunction", m, "m.thing", [], "return") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectCalled(m.thing, "getFunction", m, "m.thing", [ "arg1" "arg2" @@ -894,7 +893,7 @@ describe('RooibosPlugin', () => { m.done() return invalid end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectCalled(m.thing, "getFunction", m, "m.thing", [ "arg1" "arg2" @@ -934,7 +933,7 @@ describe('RooibosPlugin', () => { b = { someValue: "value" } - m.currentAssertLineNumber = 12 + m.currentAssertLineNumber = 13 m.assertEqual(b, { someValue: "value" }) @@ -971,19 +970,19 @@ describe('RooibosPlugin', () => { item = { id: "item" } - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectCalled(item, "getFunction", item, "item", []) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectCalled(item, "getFunction", item, "item", [], "return") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectCalled(item, "getFunction", item, "item", [ "arg1" "arg2" @@ -992,7 +991,7 @@ describe('RooibosPlugin', () => { m.done() return invalid end if - m.currentAssertLineNumber = 10 + m.currentAssertLineNumber = 11 m._expectCalled(item, "getFunction", item, "item", [ "arg1" "arg2" @@ -1035,7 +1034,7 @@ describe('RooibosPlugin', () => { item = { id: "item" } - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectCalled(sayHello, "sayHello", invalid, invalid, [ "arg1" "arg2" @@ -1044,19 +1043,19 @@ describe('RooibosPlugin', () => { m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectCalled(sayHello, "sayHello", invalid, invalid, []) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectCalled(sayHello, "sayHello", invalid, invalid, [], "return") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 10 + m.currentAssertLineNumber = 11 m._expectCalled(sayHello, "sayHello", invalid, invalid, [ "arg1" "arg2" @@ -1126,7 +1125,7 @@ describe('RooibosPlugin', () => { item = { id: "item" } - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectCalled(utils_sayhello, "utils_sayhello", invalid, invalid, [ "arg1" "arg2" @@ -1135,19 +1134,19 @@ describe('RooibosPlugin', () => { m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectCalled(utils_sayhello, "utils_sayhello", invalid, invalid, []) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectCalled(utils_sayhello, "utils_sayhello", invalid, invalid, [], "return") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 10 + m.currentAssertLineNumber = 11 m._expectCalled(utils_sayhello, "utils_sayhello", invalid, invalid, [ "arg1" "arg2" @@ -1364,19 +1363,19 @@ describe('RooibosPlugin', () => { m.wasCalled = true return true end function) - m.currentAssertLineNumber = 12 + m.currentAssertLineNumber = 13 m.assertTrue(globalFunctionWithReturn()) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 13 + m.currentAssertLineNumber = 14 m.assertTrue(getGlobalAA().wasCalled) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 14 + m.currentAssertLineNumber = 15 m.assertRunningTestIsPassed() if m.currentResult?.isFail = true then m.done() @@ -1424,19 +1423,19 @@ describe('RooibosPlugin', () => { m.wasCalled = true return true end function) - m.currentAssertLineNumber = 12 + m.currentAssertLineNumber = 13 m.assertTrue(testNamespace_functionWithReturn()) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 13 + m.currentAssertLineNumber = 14 m.assertTrue(getGlobalAA().wasCalled) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 14 + m.currentAssertLineNumber = 15 m.assertRunningTestIsPassed() if m.currentResult?.isFail = true then m.done() @@ -1486,19 +1485,19 @@ describe('RooibosPlugin', () => { return true end function m.stubCall(testNamespace_functionWithReturn, stub) - m.currentAssertLineNumber = 13 + m.currentAssertLineNumber = 14 m.assertTrue(testNamespace_functionWithReturn()) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 14 + m.currentAssertLineNumber = 15 m.assertTrue(getGlobalAA().wasCalled) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 15 + m.currentAssertLineNumber = 16 m.assertRunningTestIsPassed() if m.currentResult?.isFail = true then m.done() @@ -1546,19 +1545,19 @@ describe('RooibosPlugin', () => { m.wasCalled = true return true end function) - m.currentAssertLineNumber = 12 + m.currentAssertLineNumber = 13 m.assertTrue(testNamespace_functionWithReturn()) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 13 + m.currentAssertLineNumber = 14 m.assertTrue(getGlobalAA().wasCalled) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 14 + m.currentAssertLineNumber = 15 m.assertRunningTestIsPassed() if m.currentResult?.isFail = true then m.done() @@ -1608,19 +1607,19 @@ describe('RooibosPlugin', () => { return true end function m.stubCall(testNamespace_functionWithReturn, stub) - m.currentAssertLineNumber = 13 + m.currentAssertLineNumber = 14 m.assertTrue(testNamespace_functionWithReturn()) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 14 + m.currentAssertLineNumber = 15 m.assertTrue(getGlobalAA().wasCalled) if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 15 + m.currentAssertLineNumber = 16 m.assertRunningTestIsPassed() if m.currentResult?.isFail = true then m.done() @@ -1664,7 +1663,7 @@ describe('RooibosPlugin', () => { expect( getTestFunctionContents() ).to.eql(undent` - m.currentAssertLineNumber = 15 + m.currentAssertLineNumber = 16 m.assertArrayContainsOnlyValuesOfType(values, typeName) if m.currentResult?.isFail = true then m.done() @@ -1672,7 +1671,7 @@ describe('RooibosPlugin', () => { end if isFail = m.currentResult.isFail m.currentResult.Reset() - m.currentAssertLineNumber = 20 + m.currentAssertLineNumber = 21 m.assertFalse(isFail) if m.currentResult?.isFail = true then m.done() @@ -1704,25 +1703,25 @@ describe('RooibosPlugin', () => { expect( getTestFunctionContents() ).to.eql(undent` - m.currentAssertLineNumber = 6 + m.currentAssertLineNumber = 7 m._expectNotCalled(m.thing, "callFunc", m, "m.thing") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectNotCalled(m.thing, "callFunc", m, "m.thing", "return") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectNotCalled(m.thing, "callFunc", m, "m.thing") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectNotCalled(m.thing, "callFunc", m, "m.thing", "return") if m.currentResult?.isFail = true then m.done() @@ -1752,13 +1751,13 @@ describe('RooibosPlugin', () => { getTestFunctionContents() ).to.eql(undent` thing = {} - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectNotCalled(thing, "callFunc", thing, "thing") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectNotCalled(thing, "callFunc", thing, "thing") if m.currentResult?.isFail = true then m.done() @@ -1798,7 +1797,7 @@ describe('RooibosPlugin', () => { expect( getTestFunctionContents() ).to.eql(undent` - m.currentAssertLineNumber = 6 + m.currentAssertLineNumber = 7 m._expectNotCalled(m.thing, "getFunctionField", m, "m.thing") if m.currentResult?.isFail = true then m.done() @@ -1835,25 +1834,25 @@ describe('RooibosPlugin', () => { expect( getTestFunctionContents() ).to.eql(undent` - m.currentAssertLineNumber = 6 + m.currentAssertLineNumber = 7 m._expectNotCalled(m.thing, "getFunction", m, "m.thing") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectNotCalled(m.thing, "getFunction", m, "m.thing", "return") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectNotCalled(m.thing, "getFunction", m, "m.thing") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 9 + m.currentAssertLineNumber = 10 m._expectNotCalled(m.thing, "getFunction", m, "m.thing", "return") if m.currentResult?.isFail = true then m.done() @@ -1885,13 +1884,13 @@ describe('RooibosPlugin', () => { item = { id: "item" } - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectNotCalled(item, "getFunction", item, "item") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectNotCalled(item, "getFunction", item, "item") if m.currentResult?.isFail = true then m.done() @@ -2088,13 +2087,13 @@ describe('RooibosPlugin', () => { item = { id: "item" } - m.currentAssertLineNumber = 7 + m.currentAssertLineNumber = 8 m._expectNotCalled(item, "getFunction", item, "item") if m.currentResult?.isFail = true then m.done() return invalid end if - m.currentAssertLineNumber = 8 + m.currentAssertLineNumber = 9 m._expectNotCalled(item, "getFunction", item, "item") if m.currentResult?.isFail = true then m.done() diff --git a/framework/src/source/rooibos/ConsoleTestReporter.bs b/framework/src/source/rooibos/ConsoleTestReporter.bs index 3d4cf1ae..bbbadc93 100644 --- a/framework/src/source/rooibos/ConsoleTestReporter.bs +++ b/framework/src/source/rooibos/ConsoleTestReporter.bs @@ -129,7 +129,7 @@ namespace rooibos locationLine = StrI(test.lineNumber).trim() else if test.result.isFail testChar = "-" - locationLine = StrI(test.result.lineNumber + 1).trim() + locationLine = StrI(test.result.lineNumber).trim() else testChar = "|" locationLine = StrI(test.lineNumber).trim() @@ -182,7 +182,7 @@ namespace rooibos else if test.result.isFail m.printLine(0, " | " + insetText + " |--Failed at: " + locationText) if test.isParamTest = true - m.printLine(0, " | " + insetText + " |--Param Line: " + StrI(test.paramLineNumber - 1).trim()) + m.printLine(0, " | " + insetText + " |--Param Line: " + StrI(test.paramLineNumber).trim()) end if m.printLine(0, " | " + insetText + " |--Error Message: " + test.result.message) m.printLine(0, " | ") diff --git a/framework/src/source/rooibos/MochaTestReporter.bs b/framework/src/source/rooibos/MochaTestReporter.bs index 4cf18d42..0a93f6ac 100644 --- a/framework/src/source/rooibos/MochaTestReporter.bs +++ b/framework/src/source/rooibos/MochaTestReporter.bs @@ -178,10 +178,18 @@ namespace rooibos end if if test.isParamTest - resultMessage += `${string(1, chr(9))}params at (file://${test.testSuite.filePath.trim()}:${Rooibos.Common.AsString(test.paramLineNumber + 1)})\n` - resultMessage += `${string(1, chr(9))}assertion at (file://${test.testSuite.filePath.trim()}:${Rooibos.Common.AsString(test.lineNumber)})\n` + resultMessage += `${string(1, chr(9))}params at (file://${test.testSuite.filePath.trim()}:${Rooibos.Common.AsString(test.paramLineNumber)})\n` + if test.result.lineNumber > -1 + resultMessage += `${string(1, chr(9))}assertion at (file://${test.testSuite.filePath.trim()}:${Rooibos.Common.AsString(test.result.lineNumber)})\n` + else + resultMessage += `${string(1, chr(9))}test at (file://${test.testSuite.filePath.trim()}:${Rooibos.Common.AsString(test.lineNumber)})\n` + end if else - resultMessage += `${string(1, chr(9))}at (file://${test.testSuite.filePath.trim()}:${Rooibos.Common.AsString(test.lineNumber)})\n` + if test.result.lineNumber > -1 + resultMessage += `${string(1, chr(9))}at (file://${test.testSuite.filePath.trim()}:${Rooibos.Common.AsString(test.result.lineNumber)})\n` + else + resultMessage += `${string(1, chr(9))}at (file://${test.testSuite.filePath.trim()}:${Rooibos.Common.AsString(test.lineNumber)})\n` + end if end if print resultMessage end if