Refactor MultiLineAssertions to use SingleLineAssertions internally #84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes significant refactoring and enhancements to the multi-line assertion functionality within the codebase. The changes mainly focus on replacing the old method of handling multi-line assertions with a more structured and flexible approach. Additionally, some minor improvements and cleanups are included.
Refactoring and Enhancements:
internal/assertions/multi_line_assertion.go
: Replaced theExpectedOutput
andFallbackPatterns
fields with aSingleLineAssertions
slice. Added methods to construct and manipulate multi-line assertions, includingNewMultiLineAssertion
,NewEmptyMultiLineAssertion
,AddSingleLineAssertion
, and updatedRun
method to handle the new structure.internal/stage_r1.go
: Updated thetestR1
function to use the newMultiLineAssertion
constructor for multi-line test cases. [1] [2]internal/stage_r3.go
: Updated thetestR3
function to use the newMultiLineAssertion
constructor for multi-line test cases. [1] [2] [3] [4]internal/stage_r4.go
: Enhanced thetestR4
function to use the newMultiLineAssertion
structure, including handling regex patterns for error messages.Minor Improvements:
internal/test_cases/command_reflection_test_case.go
andinternal/test_cases/command_response_test_case.go
: Modified theRun
method to use formatted strings for success messages. [1] [2]internal/test_cases/command_with_multiline_response_test_case.go
: Updated theCommandWithMultilineResponseTestCase
struct to use the newMultiLineAssertion
field and modified theRun
method accordingly. [1] [2] [3]