Skip to content

fix: improve delimiter escaping for double-quoted strings #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2025

Conversation

k1LoW
Copy link
Owner

@k1LoW k1LoW commented May 4, 2025

This pull request introduces enhancements to the YAML interpolation and delimiter unescaping logic, along with expanded test coverage. The changes aim to improve handling of escaped delimiters and double-quoted strings, ensuring more robust functionality.

Enhancements to delimiter handling:

  • Modified func unescapeDelims in repfn.go to detect and handle double-quoted strings heuristically. Adjusted the escaping logic to account for double quotes by adding extra backslashes when necessary.

Improvements to interpolation function:

  • Updated func ExprRepFn in repfn.go to use named return values for better readability and consistency.

Expanded test coverage:

  • Added multiple test cases in func TestReplaceYAMLWithExprRepFn in expand_test.go to validate interpolation and escaping behavior for various YAML scenarios, including nested maps, multiline strings, and JSON-like structures.

@k1LoW k1LoW added the bug Something isn't working label May 4, 2025
@k1LoW k1LoW self-assigned this May 4, 2025
Copy link
Contributor

github-actions bot commented May 4, 2025

Code Metrics Report

main (5c395c5) #75 (3b9cfaa) +/-
Coverage 84.0% 84.8% +0.8%
Code to Test Ratio 1:1.7 1:1.8 +0.0
Test Execution Time - 34s +34s
Details
  |                     | main (5c395c5) | #75 (3b9cfaa) |  +/-  |
  |---------------------|----------------|---------------|-------|
+ | Coverage            |          84.0% |         84.8% | +0.8% |
  |   Files             |              3 |             3 |     0 |
  |   Lines             |            232 |           245 |   +13 |
+ |   Covered           |            195 |           208 |   +13 |
+ | Code to Test Ratio  |          1:1.7 |         1:1.8 |  +0.0 |
  |   Code              |            425 |           443 |   +18 |
+ |   Test              |            764 |           807 |   +43 |
- | Test Execution Time |              - |           34s |  +34s |

Code coverage of files in pull request scope (93.1% → 94.0%)

Files Coverage +/- Status
repfn.go 94.0% +0.8% modified

Reported by octocov

@k1LoW k1LoW merged commit 3f17435 into main May 4, 2025
1 check passed
@k1LoW k1LoW deleted the double-quoted branch May 4, 2025 13:03
@github-actions github-actions bot mentioned this pull request May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant