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.
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 ago_banditstatement in another file.Here is a short example:
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.hQt Creator raises also this warning for both
go_banditstatements.After digging in the code, I replaced
go_bandit([]() {bybandit::detail::spec_registrar TestPouet([]() {andbandit::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:
bandit::detail:spec_registrar TestPouet([]() {instead ofgo_bandit([]() {and in particular the removal of thestaticstatement.The registration is indeed not very clear to me at this time.