Catch2 integration does not handle Generators inside sections
まだ誰も着手していません。
評価
調査の方向性
ApprovalTests/integrations/catch/Catch2Approvals.h、特に sectionStarting から始め、Catch::SectionInfo の使用方法を Catch2 のジェネレーターのドキュメントおよび issue にリンクされている SectionInfo の定義と比較してください。セクション処理中にジェネレーターの実行がどのように公開されるかを調査してください。生成されたセクション内の approvals が、反復間で共有されるのではなく、ジェネレーターの各バリアントごとに一意に登録されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
}
- 主要言語
- C++
- スター
- 340
- フォーク
- 56
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
approvals/ApprovalTests.cpp のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
approvals/ApprovalTests.cpp#247 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
approvals/ApprovalTests.cpp#246 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
approvals/ApprovalTests.cpp#242 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
approvals/ApprovalTests.cpp#226 · コメント 2 件 ·
-
bug namers
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
approvals/ApprovalTests.cpp#225 · コメント 5 件 ·
approvals/ApprovalTests.cpp の issue をすべて見る
似ている issue
-
難易度 2/5 半日 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
ROCm/rocm-libraries#12703 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
isl-org/Open3D#7585 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
qbittorrent/qBittorrent#24975 ·
メンテナーはふだん 3 日以内に返信