-
-
Notifications
You must be signed in to change notification settings - Fork 67
Fixed handling of "0-" #327
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
Fixed handling of "0-" #327
Conversation
Sync with original repo
…on default-setting until after we have fetched the dynamic precision
Thanks for the PR! Could I ask a favor on these tiny ones - I understand that you're having troubles with the build system. (which, by the way, do you have access to a linux VM or WSL2 or anything like that? I wonder if that would be easier) But, for small PRs like this the turnaround is often not too bad if you use the CI runs as your build system; you can click on the "Checks" tab and click on any of the failed builds (they have red x icons), and you'll see the test failure- in this case, it looks to just be one test case:
which makes sense, given the changes here. Even if you can't run the tests locally, fixing little ones like this might be easy enough to do "remotely". (I'm happy to pull in and migrate tests for larger PRs like the %a support etc, if building the tests remains impossible). (Also sorry for the delay, I've been sick!) |
…its required. Can be overridden, eg. by precision 1 (prints the minimum number of digits) or by precision 0 (the same, but 0 will result in the empty string)
Maybe I'll try with WSL2. |
I've fixed all the issues, and reverted the changes about %p -- they need a different PR nanoprintf/tests/unit_parse_format_spec.cc Lines 151 to 153 in 49628bd
In my view, it is not correct to expect the parsing to produce !leading_zero_pad . The flag is there, and it can only be properly ignored after fetching the dynamic precision (if any), which is not part of parsing.I think these semantic constraints should be left to the caller (as is done to the main caller of the parser, ie npf_vpprintf , and not addressed by the parser.
I haven't changed that test yet, I'll be waiting for your feedback. |
Ah, I see, I just left feedback on the %p PR you opened #329 - I see the issue now, that the spec can't be resolved until the dynamic star args are read, and the latter only happens in the actual formatting code. I don't mind this change because of the nature of it, but it does mean changing or deleting existing unit tests that harnessed the previous logic of "npf_parse_format_spec only returns legal combinations". |
Addressed by #340 |
This fix is extracted from #315, as it is a bug that needed fixing for that PR, but appears in other contexts too.