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

Qt Creator doesn't follow symbol under cursor #165

Open
MartinDelille opened this issue Mar 31, 2021 · 1 comment
Open

Qt Creator doesn't follow symbol under cursor #165

MartinDelille opened this issue Mar 31, 2021 · 1 comment

Comments

@MartinDelille
Copy link
Contributor

I have a problem when editing my test since a few month: when I have more than one test file (with a go_bandit([]{ section each), querying a symbol definition with F2 in a unit test jumps to a go_bandit statement in another file.

Here is a short example:

// pouet.h
class Pouet {
  QString _name;
public:
  Pouet(QString name) : _name(name) {}
  QString name() const {
    return _name;
  }
};
// test_pouet.cpp
#include "bandit/bandit.h"
#include "pouet.h

using namespace bandit;
using namespace snowhouse;

go_bandit([]() {
  it("has a name", [] {
    Pouet pouet("martin");
    AssertThat(pouet.name(), "martin");
  });
});
// test_baba.cpp
#include "bandit/bandit.h"
#include "baba.h

using namespace bandit;
using namespace snowhouse;

go_bandit([]() {
...
});

Here asking the symbol definition of name() at the line 11 of test_pouet.cpp jumps to line 8 of test_baba.cpp instead of line 6 of pouet.h

Qt Creator raises also this warning for both go_bandit statements.

After digging in the code, I replaced go_bandit([]() { by bandit::detail::spec_registrar TestPouet([]() { and bandit::detail::spec_registrar TestBaba([]() { to restore the "jump to definition" feature and suppress the clazy warning.

I know you don't use the Qt framework but I wrote this issue to:

  • log my problem if anyone has the same issue
  • have your light about using bandit::detail:spec_registrar TestPouet([]() { instead of go_bandit([]() { and in particular the removal of the static statement.

The registration is indeed not very clear to me at this time.

@sbeyer
Copy link
Member

sbeyer commented Apr 16, 2021

Thanks for your issue. I am currently not sure where to go with the go_bandit macro (see also #164). I have a tendency to deprecate it and replace it by a non-macro solution. Still not sure where to go with it. I currently have no time to work on bandit anyway, but I have time to let that sink in.

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