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

[support] Using DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES does not compile using g++ 6.3.0 #89

Closed
FSund opened this issue Sep 8, 2017 · 2 comments

Comments

@FSund
Copy link

FSund commented Sep 8, 2017

Description

A combination of DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN, and DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES doesn't compile on g++ 6.3.0. It compiles fine without DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES.

Steps to reproduce

#include <iostream>

using namespace std;

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#define DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES
#include "doctest.h"

int factorial(int number)
{
    return number <= 1 ? number : factorial(number - 1) * number;
}

TEST_CASE("testing the factorial function")
{
    CHECK(factorial(1) == 1);
    CHECK(factorial(2) == 2);
    CHECK(factorial(3) == 6);
    CHECK(factorial(10) == 3628800);
}

Compiled using g++ -Wall main.cpp -o main using g++ version 6.3.0 gives the error

main.cpp:15:10: error: expected constructor, destructor, or type conversion before ‘(’ token
 TEST_CASE("testing the factorial function")
          ^

Extra information

  • doctest version: v1.2.2
  • Operating System: Debian 9 Stretch
  • Compiler+version: g++ 6.3.0
@onqtam
Copy link
Member

onqtam commented Sep 8, 2017

Well TEST_CASE is a short macro name - so using DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES will disable it and only DOCTEST_TEST_CASE will remain usable.

@onqtam onqtam closed this as completed Sep 8, 2017
@FSund
Copy link
Author

FSund commented Sep 8, 2017

Quite the response time here!

I did not think of that option, but should if course have realized it. I wish the error messages were better.

@onqtam onqtam changed the title Using DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES does not compile using g++ 6.3.0 [support] Using DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES does not compile using g++ 6.3.0 Sep 20, 2017
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