-
Notifications
You must be signed in to change notification settings - Fork 45
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
The indent function always adds a final \n, even if the input string has no \n #207
Comments
also adds part of the python indent test suite
Hi @jRimbault Thank you very much for the excellent bug report and the accompanying fixes! Since it uses a nightly API, I guess we'll just let is sit and wait for a bit...? In the mean time, I'll have to look at why the tests didn't actually break as expected! I recently switched to GitHub actions, but I must have misconfigured it somehow :-) If I read #208 and #209 correctly, then I think #208 is a subset of #209? If so, I would prefer to close #208 and simply merge the tests together with the implementation. |
I made #208 in case you wanted to merge the tests in some working branch of yours ? It's really only just in case it's useful to you. If you look at #209's history detail you'll see I made other partial fixes (559df5c) before using the nightly feature, but I couldn't figure it out completely. I thought you should have a go at fixing it yourself if interested ^^ of course you can close it I think waiting for the split_inclusive to be in stable shouldn't take too long, it's a simple feature and it's only missing a stabilization PR. PS: in your workflow you only need
|
Thanks to @jRimbault for explaining how to fix this in #207.
Thanks to @jRimbault for explaining how to fix this in #207. To avoid running no less than eight checks whenever I push something to a new branch, we now only run the build workflow on pushes to the master branch.
Thanks for the tip about fixing the GitHub workflow! I don't have a working branch as such, so I'll just close #208 for now. |
Before, indent("foo", "") would give "foo\n". It now preserves any trailing newline character present in the input string. This makes indent behave consistently with dedent. New tests ere added to ensure this on a number of corner cases. closes mgeisler#207
…iling \n) [stable rustc] (#279) * Make indent preserve newlines or lack thereof Before, indent("foo", "") would give "foo\n". It now preserves any trailing newline character present in the input string. This makes indent behave consistently with dedent. New tests ere added to ensure this on a number of corner cases. Closes #207.
Example:
There should be the same number of lines in the input and output (unless the prefix contains a newline).
Python tests reference, python source reference, can't be implemented the same way in rust without the
split_inclusive
feature. (cf. python'ssplitlines
)Python script passes the same test
The text was updated successfully, but these errors were encountered: