Skip to content
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

Handle blank lines in Yaml.Text() #887

Merged
merged 1 commit into from Jan 23, 2024

Conversation

dougbu
Copy link
Contributor

@dougbu dougbu commented Jan 7, 2024

  • see Yaml.Text(...) fumbles without trailing whitespace #886
  • transform blank lines to string.Empty
  • remove all trailing whitespace from lines
    • if trailing whitespace is significant in a future test, YAML files can be added
  • throw new ArgumentException(...) if a line is insufficiently indented
    • should be easier to fix test than with previous ArgumentOutOfRangeException for this case
  • add tests

@@ -252,7 +252,7 @@ public void DeserializeWithGapsBetweenKeys()
{
var yamlReader = new StringReader(@"Text: >
Some Text.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whitespace-only changes in this file are essentially end-to-end tests of Yaml.Text() 😄


namespace YamlDotNet.Test
{
public class YamlTests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, this test class does not cover the Yaml test helper class comprehensively. it covers what I changed in Yaml.Text() however

- see aaubry#886
- transform blank lines to `string.Empty`
- remove all trailing whitespace from lines
  - if trailing whitespace is significant in a future test, YAML files can be added
- `throw new ArgumentException(...)` if a line is insufficiently indented
  - should be easier to fix test than with previous `ArgumentOutOfRangeException` for this case
- add tests
@EdwardCooke EdwardCooke merged commit fa65881 into aaubry:master Jan 23, 2024
1 check passed
@aaubry
Copy link
Owner

aaubry commented Jan 23, 2024

This feature has been released in version 15.1.0.

@dougbu dougbu deleted the dougbu/blank.lines.886 branch January 23, 2024 03:21
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.

None yet

3 participants