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

Command line flags do not work after code formatter/beautifier #104

Closed
vladimirgamalyan opened this issue Nov 30, 2017 · 5 comments
Closed

Comments

@vladimirgamalyan
Copy link
Contributor

Description

Visual studio 2017 automatically formats code when I paste code from github.com/doctest.h. Everything works fine, but a few command line flags.
I guess, additional spaces in calls DOCTEST_PARSE_AS_BOOL_OR_FLAG do the bug.

Steps to reproduce

Add spaces (around '-') to:
DOCTEST_PARSE_AS_BOOL_OR_FLAG(dt - exit, dt - e, exit, false);

Now, shouldExit() always returns false (with "--exit" arg).

Extra information

  • doctest version: v1.2.6
  • Operating System: Windows 10 x64 build 1709
  • Compiler+version: Visual Studio 2017
@onqtam
Copy link
Member

onqtam commented Dec 1, 2017

For that particular piece of code I've turned off clang-format (using // clang-format off and // clang-format on) but I guess you aren't using clang-format with VS but maybe the default VS formatting... This isn't a doctest issue per-se.

I'm not sure what to do about this... Can you download the header file and just open/use it instead of pasting its contents in VS?

@vladimirgamalyan
Copy link
Contributor Author

Sure, I'v already downloaded the file (and exclude it from pre-git-hook style tools).
I think this format-depended code a bit fragile, so it would be nice if a compilation error occurred in case you accidentally reformat sources.

@onqtam
Copy link
Member

onqtam commented Dec 1, 2017

I'll think about how to avoid this, thanks :)

@vladimirgamalyan
Copy link
Contributor Author

BTW is there some penalty (compile time) with quoted strings as macros arguments?

@onqtam
Copy link
Member

onqtam commented Dec 11, 2017

If you are wondering if I can pass something like "dt-success" to DOCTEST_PARSE_AS_BOOL_OR_FLAG and just concatenate in the macro the given string with "=" in here - I'm wondering the same - and will try it :)

@onqtam onqtam closed this as completed in fd00d4c Feb 6, 2018
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

No branches or pull requests

2 participants