diff --git a/src/BlankIWBProxy.cls b/src/BlankIWBProxy.cls index 92b2ea4..60c7d2f 100644 --- a/src/BlankIWBProxy.cls +++ b/src/BlankIWBProxy.cls @@ -8,7 +8,7 @@ Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = False '' -' BlankIWBProxy v1.2.1 +' BlankIWBProxy v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Blank implementation of IWBProxy diff --git a/src/DisplayRunner.bas b/src/DisplayRunner.bas index 4aacf71..de4fee1 100644 --- a/src/DisplayRunner.bas +++ b/src/DisplayRunner.bas @@ -1,6 +1,6 @@ Attribute VB_Name = "DisplayRunner" '' -' DisplayRunner v1.2.1 +' DisplayRunner v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Runner with sheet output @@ -137,6 +137,7 @@ Public Sub RunSuites(SuiteCol As Collection, Optional Append As Boolean = False) Dim Suite As SpecSuite Dim Spec As SpecDefinition Dim Row As Integer + Dim Indentation As String ' 0. Disable screen updating Dim PrevUpdating As Boolean @@ -153,8 +154,15 @@ Public Sub RunSuites(SuiteCol As Collection, Optional Append As Boolean = False) Row = NewOutputRow For Each Suite In SuiteCol If Not Suite Is Nothing Then + If Suite.Description <> "" Then + OutputSuiteDetails Suite, Row + Indentation = " " + Else + Indentation = "" + End If + For Each Spec In Suite.SpecsCol - OutputSpec Spec, Row + OutputSpec Spec, Row, Indentation Next Spec End If Next Suite @@ -189,21 +197,36 @@ End Sub ' Internal ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' -Private Sub OutputSpec(Spec As SpecDefinition, ByRef Row As Integer) - +Private Sub OutputSpec(Spec As SpecDefinition, ByRef Row As Integer, Optional Indentation As String = "") Sheet.Cells(Row, IdCol) = Spec.Id - Sheet.Cells(Row, DescCol) = "It " & Spec.Description + Sheet.Cells(Row, DescCol) = Indentation & Spec.Description Sheet.Cells(Row, ResultCol) = Spec.ResultName Row = Row + 1 - If Spec.FailedExpectations.Count > 0 Then + If Spec.FailedExpectations.count > 0 Then Dim Exp As SpecExpectation For Each Exp In Spec.FailedExpectations - Sheet.Cells(Row, DescCol) = "X " & Exp.FailureMessage + Sheet.Cells(Row, DescCol) = Indentation & "X " & Exp.FailureMessage Row = Row + 1 Next Exp End If +End Sub + +Private Sub OutputSuiteDetails(Suite As SpecSuite, ByRef Row As Integer) + Dim HasFailure As Boolean + Dim Result As String + Result = "Pass" + For Each Spec In Suite.SpecsCol + If Spec.Result = SpecResult.Fail Then + Result = "Fail" + Exit For + End If + Next Spec + + Sheet.Cells(Row, DescCol) = Suite.Description + Sheet.Cells(Row, ResultCol) = Result + Row = Row + 1 End Sub Private Sub ClearOutput() diff --git a/src/IScenario.cls b/src/IScenario.cls index 7456626..f6d6f72 100644 --- a/src/IScenario.cls +++ b/src/IScenario.cls @@ -8,7 +8,7 @@ Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = True '' -' IScenario v1.2.1 +' IScenario v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Interface for creating and running scenarios on workbooks diff --git a/src/IWBProxy.cls b/src/IWBProxy.cls index 5fb5012..7936b7b 100644 --- a/src/IWBProxy.cls +++ b/src/IWBProxy.cls @@ -8,7 +8,7 @@ Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = True '' -' IWBProxy v1.2.1 +' IWBProxy v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Interface for generic workbook proxies diff --git a/src/InlineRunner.bas b/src/InlineRunner.bas index 3b75509..2bd2ab4 100644 --- a/src/InlineRunner.bas +++ b/src/InlineRunner.bas @@ -1,6 +1,6 @@ Attribute VB_Name = "InlineRunner" '' -' InlineRunner v1.2.1 +' InlineRunner v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Runner for outputting results of specs to Immediate window diff --git a/src/Scenario.cls b/src/Scenario.cls index a09c8a1..3afa768 100644 --- a/src/Scenario.cls +++ b/src/Scenario.cls @@ -8,7 +8,7 @@ Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = True '' -' Scenario v1.2.1 +' Scenario v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Generic implementation of scenario diff --git a/src/SpecDefinition.cls b/src/SpecDefinition.cls index 26d5476..f5b5d34 100644 --- a/src/SpecDefinition.cls +++ b/src/SpecDefinition.cls @@ -8,7 +8,7 @@ Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = True '' -' SpecDefinition v1.2.1 +' SpecDefinition v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Provides helpers and acts as workbook proxy diff --git a/src/SpecExpectation.cls b/src/SpecExpectation.cls index 2d81e5b..8853be9 100644 --- a/src/SpecExpectation.cls +++ b/src/SpecExpectation.cls @@ -8,7 +8,7 @@ Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = True '' -' SpecExpectation v1.2.1 +' SpecExpectation v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Provides various tests that can be performed for a provided value @@ -190,6 +190,38 @@ Public Sub ToBeGTE(Value As Variant) Call ToBeGreaterThanOrEqualTo(Value) End Sub +'' +' Check if the defined string contains the test string +' +' @param {Variant} Value +' --------------------------------------------- ' + +Public Sub ToContain(Value As Variant, Optional MatchCase As Boolean = True) + If MatchCase And InStr(Me.ExpectValue, Value) > 0 Then + Passes + ElseIf Not MatchCase And InStr(UCase(Me.ExpectValue), UCase(Value)) > 0 Then + Passes + Else + Fails CreateFailureMessage("to contain", Value) + End If +End Sub + +'' +' Check that the defined string does not contain the test string +' +' @param {Variant} Value +' --------------------------------------------- ' + +Public Sub ToNotContain(Value As Variant, Optional MatchCase As Boolean = True) + If MatchCase And InStr(Me.ExpectValue, Value) > 0 Then + Fails CreateFailureMessage("to not contain", Value) + ElseIf Not MatchCase And InStr(UCase(Me.ExpectValue), UCase(Value)) > 0 Then + Fails CreateFailureMessage("to not contain", Value) + Else + Passes + End If +End Sub + ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' ' Internal Methods diff --git a/src/SpecHelpers.bas b/src/SpecHelpers.bas index 86e20d6..812a55e 100644 --- a/src/SpecHelpers.bas +++ b/src/SpecHelpers.bas @@ -1,6 +1,6 @@ Attribute VB_Name = "SpecHelpers" '' -' SpecHelpers v1.2.1 +' SpecHelpers v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' General utilities for specs diff --git a/src/SpecSuite.cls b/src/SpecSuite.cls index e28c663..a472395 100644 --- a/src/SpecSuite.cls +++ b/src/SpecSuite.cls @@ -8,7 +8,7 @@ Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = True '' -' SpecSuite v1.2.1 +' SpecSuite v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' A collection of specs with the workbook that they act on diff --git a/src/WBProxy.cls b/src/WBProxy.cls index ae59d7a..80d8194 100644 --- a/src/WBProxy.cls +++ b/src/WBProxy.cls @@ -8,7 +8,7 @@ Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = True '' -' WBProxy v1.2.1 +' WBProxy v1.2.2 ' (c) Tim Hall - https://github.com/timhall/Excel-TDD ' ' Generic implementation of workbook proxy