-
Notifications
You must be signed in to change notification settings - Fork 374
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
Fix nested values can span sections #306
Conversation
assert.Equal(t, "value3", f.Section("section2").Key("key3").String()) | ||
}) | ||
|
||
t.Run("no nested values and following sections with indentation", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only test that fails prior to my fix, but I added the other subtests just to have some more comprehensive coverage, since there are currently no nested value tests at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
GitHub Action got stuck and does not run, I'm gonna try close and reopen the PR see if helps. |
Codecov Report
@@ Coverage Diff @@
## main #306 +/- ##
==========================================
+ Coverage 88.11% 88.21% +0.09%
==========================================
Files 9 9
Lines 1355 1349 -6
==========================================
- Hits 1194 1190 -4
+ Misses 98 96 -2
Partials 63 63 |
https://github.com/go-ini/ini/releases/tag/v1.66.2 has been tagged for this merge. |
What problem should be fixed?
When configured with
AllowNestedValues: true
, the parser attempts to parse values "nested" under a key, AWS-style. To trigger this behavior, the parent key must have an empty value, and child keys must be indented. However, if the next value is in a different section, it cannot be a nested value, but the parser can treat it as such anyways. As an example:Before this PR,
key3
is treated as a nested value underkey2
, andsection2
has no keys.Have you added test cases to catch the problem?
Yes, I've added tests that cover the issue and fail on the current tip of
main
.