Skip to content

fix(engine): match Sprig string slicing#79

Merged
GaTTGeng merged 2 commits into
masterfrom
feature/10-core-function-parity
Jun 28, 2026
Merged

fix(engine): match Sprig string slicing#79
GaTTGeng merged 2 commits into
masterfrom
feature/10-core-function-parity

Conversation

@GaTTGeng

Copy link
Copy Markdown
Owner

Summary

  • Align trunc with Helm/Sprig for negative lengths so it returns the tail of the string.
  • Treat substr's second argument as an end index instead of a length.
  • Add regression coverage and update [Unreleased].

Why

M1 function parity tracks common Helm/Sprig behavior. Helm CLI renders trunc -5 "hello world" as world and substr 1 5 "hello world" as ello; HelmSharp previously returned different results.

Fixes #10

Verification

  • helm template scratch chart comparison for trunc and substr
  • dotnet test tests/HelmSharp.Tests/HelmSharp.Tests.csproj --filter FullyQualifiedName~TemplateFunctionTests --configuration Release
  • dotnet test HelmSharp.sln --configuration Release

GaTTGeng added 2 commits June 28, 2026 11:54
Align trunc and substr behavior with Helm/Sprig for negative trunc lengths and substring end indexes. Add regression coverage and record the M1 parity fix in the changelog.
Normalize negative substr end indexes to the input length before range validation, matching Helm/Sprig's -1 sentinel behavior. Add regression coverage for full-string and tail substr calls.
@GaTTGeng GaTTGeng marked this pull request as ready for review June 28, 2026 09:47
Copilot AI review requested due to automatic review settings June 28, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@GaTTGeng GaTTGeng merged commit a1ea844 into master Jun 28, 2026
1 check passed
@GaTTGeng GaTTGeng deleted the feature/10-core-function-parity branch June 28, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M1] Expand core function parity

2 participants