Add comprehensive test coverage for KVP splitting with multiple equals signs #42
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 PR addresses issue #35 by adding comprehensive test coverage for the KVP (key-value pair) splitting functionality in
ComposeListOrMapElement.Issue Summary
Issue #35 reported that parsing strings like
"JAVA_OPTS=foo=bar&&baz=buzz"would fail due to incorrect splitting on all=characters instead of just the first one.Current State
The implementation in
compose_list_or_map.pyline 18 already correctly usessplit("=", 1)to split only on the first=character:This means the bug was already fixed, but there was no test coverage to prevent regression.
Changes Made
Added comprehensive test cases to
test_service_environment.py:test_kvp_with_multiple_equals_issue_35()- Tests the exact scenario from issue Splitting kvp on '=' creates bug if the string contains more than one '=' #35:test_kvp_splitting_edge_cases()- Tests various edge cases:KEY=valueKEY=value=extra,KEY=a=b=c=dURL=http://example.com:8080/path?param=valueCONFIG=key1=val1,key2=val2COMPLEX=a=b&c=d&e=fNO_VALUEtest_empty_value_handling()- Ensures existing behavior for empty values is preservedValidation
All tests pass, confirming that:
=characters=signs without breaking the parserFixes #35.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.