You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many editors either automatically remove trailing whitespace or have extensions that do so. Unfortunately, when trailing whitespace is removed from (say) Serialization/SerializationTests.cs, multiple tests fail with e.g.,
[xUnit.net 00:00:03.99] ExampleFromSpecificationIsHandledCorrectly [FAIL]
Failed ExampleFromSpecificationIsHandledCorrectly [1 ms]
Error Message:
System.ArgumentOutOfRangeException : startIndex cannot be larger than length of string. (Parameter 'startIndex')
Stack Trace:
at System.String.Substring(Int32 startIndex, Int32 length)
at System.String.Substring(Int32 startIndex)
at YamlDotNet.Test.Yaml.<>c__DisplayClass10_0.<Text>b__2(String l) in C:\dd\dnx\other\YamlDotNet\YamlDotNet.Test\Yaml.cs:line 111
at System.Linq.Enumerable.SelectListIterator`2.ToList()
at YamlDotNet.Test.Yaml.Text(String yamlText) in C:\dd\dnx\other\YamlDotNet\YamlDotNet.Test\Yaml.cs:line 110
at YamlDotNet.Test.Serialization.SerializationTests.ExampleFromSpecificationIsHandledCorrectly() in C:\dd\dnx\other\YamlDotNet\YamlDotNet.Test\Serialization\SerializationTests.cs:line 1230
That particular test fails at the empty line near the top of the yamlText:
obj:
- &CENTER { x: 1, y: 2 }- &LEFT { x: 0, y: 2 }- &BIG { r: 10 }- &SMALL { r: 1 }# All the following maps are equal:
Fix is fairly simple. I'll put up a PR in a bit…
To Reproduce
Edit Serialization/SerializationTests.cs and remove all trailing whitespace, at least in the ExampleFromSpecificationIsHandledCorrectly() fact. Then, execute that test.
The text was updated successfully, but these errors were encountered:
dougbu
added a commit
to dougbu/YamlDotNet
that referenced
this issue
Jan 7, 2024
- 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
- 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
Describe the bug
Many editors either automatically remove trailing whitespace or have extensions that do so. Unfortunately, when trailing whitespace is removed from (say) Serialization/SerializationTests.cs, multiple tests fail with e.g.,
That particular test fails at the empty line near the top of the
yamlText
:Fix is fairly simple. I'll put up a PR in a bit…
To Reproduce
Edit Serialization/SerializationTests.cs and remove all trailing whitespace, at least in the
ExampleFromSpecificationIsHandledCorrectly()
fact. Then, execute that test.The text was updated successfully, but these errors were encountered: