-
Notifications
You must be signed in to change notification settings - Fork 16
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
Code coverage for >+
#44
Comments
Hi @jonasfj, I think this code won't execute under any circumstances. Because the string has leading or trailing spaces, it is interpreted as PLAIN. yaml_edit/lib/src/strings.dart Lines 183 to 197 in aaa1d53
|
Hmm, that might make sense. I guess it's rare that something starts with whitespace -- and in such circumstances it might be simpler to just fallback to a safer string style. I wonder if we should refactor the string handling. I probably don't have too good an overview. Perhaps a good start is to write down what string styles we have, where they can be used, and what limits they have. Some strings styles can't represent any string. |
I think if a string does not contain special characters, it can be representable as both a folded string and a literal string. For strings that begin with spaces or line breaks, we need to use block styles with indication indicators to implement it. By using this method, even a single space can be represented. Therefore, if we improve However, cases where strings begin with spaces or line breaks are relatively rare, and some interpreters may parse them incorrectly. If considering a safer approach, falling back to a more secure string style will never be wrong. |
We have no test that exercise this code:
https://coveralls.io/builds/57565406/source?filename=lib%2Fsrc%2Fstrings.dart#L103
That might be a good idea to have some tests for. Maybe there is bugs?
The text was updated successfully, but these errors were encountered: