Catch2 integration does not handle Generators inside sections
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia da ApprovalTests/integrations/catch/Catch2Approvals.h, in particolare da sectionStarting, quindi confronta il suo utilizzo di Catch::SectionInfo con la documentazione dei generatori di Catch2 e con la definizione di SectionInfo collegata nell’issue. Analizza come vengono esposte le esecuzioni dei generatori durante la gestione delle sezioni. Il lavoro è completato quando le approval all’interno di una sezione generata vengono registrate in modo univoco per ogni variante del generatore invece di essere condivise tra le iterazioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Per Catch2 documentation:
GENERATE can be seen as an implicit SECTION, that goes from the place GENERATE is used, to the end of the scope.
[...]
The fact that GENERATE introduces a virtual SECTION can also be used to make a generator replay only some SECTIONs, without having to explicitly add a SECTION
I looked into the Catch2 integration and it seems like the Catch2 API does not include generator information as part of the sector:
// Approvals/integrations/catch/Cathc2Approvals.h
struct Catch2TestCommitRevert : Catch::TestEventListenerBase
{
...
virtual void sectionStarting(Catch::SectionInfo const& sectionInfo) override
{
currentTest.sections.push_back(sectionInfo.name); // Name here does not include the generator value
}
...
};
In fact, if you look at the Catch::SectionInfo type it only includes name and source location. I'm no expert on the Catch2 internals but at first glance, I would say Catch2 generators are handled more like part of the body of a section rather than variants of the parent section (Like generated tests cases in other frameworks).
The result of this behavior is that if you run an approval inside a section with a generator, the approval is uniquely registered for the section rather than each generated variant of the section, resulting in approval failures following the execution of the different variants of the section:
enum class Keyword
{
Unknown, Foo, Bar, Quux
};
Keyword parseKeyword(const std::string_view word);
SECTION("Verify our parsing algorithm works with the most relevant words in the vocabulary of a programmer")
{
const std::string_view word = GENERATE("foo", "bar", "quux");
Approvals::verify(parseKeyword(word)); // If we approve "foo", it fails in the next iteration of the generator
}
- Lingua principale
- C++
- Stelle
- 340
- Fork
- 56
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di approvals/ApprovalTests.cpp
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
approvals/ApprovalTests.cpp#247 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
approvals/ApprovalTests.cpp#246 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
approvals/ApprovalTests.cpp#242 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
approvals/ApprovalTests.cpp#226 · 2 commenti ·
-
bug namers
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
approvals/ApprovalTests.cpp#225 · 5 commenti ·
Tutte le issue di approvals/ApprovalTests.cpp
Issue simili
-
bug
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
isl-org/Open3D#7585 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Unconfirmed bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
luanti-org/luanti#17605 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
area: config area: firmware priority: P2 - medium size: S type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Mizithra/ActiveTerrain#16 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
grumpycoders/pcsx-redux#2171 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 2 giorni