Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2023-02-01 18:27:41 +0100
committerMartin Hořeňovský2023-02-01 18:27:41 +0100
commit42d9d4533e8583506463ab1e688add6542b15ad4 (patch)
treef2801bffebe29188f883d676039126d0f63985e0 /tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
parent618d44c4482d99dca5515e83ad6a06b5fa49f175 (diff)
downloadcatch3-42d9d4533e8583506463ab1e688add6542b15ad4.tar.gz
Add test for empty result of filter generator
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp')
-rw-r--r--tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
index 1c203b6b..64e943f8 100644
--- a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
@@ -16,6 +16,7 @@
#include <catch2/generators/catch_generators_adapters.hpp>
#include <catch2/generators/catch_generators_random.hpp>
#include <catch2/generators/catch_generators_range.hpp>
+#include <catch2/generators/catch_generator_exception.hpp>
// Tests of generator implementation details
TEST_CASE("Generators internals", "[generators][internals]") {
@@ -534,3 +535,12 @@ TEST_CASE( "Random generators can be seeded", "[generators][approvals]" ) {
}
}
}
+
+TEST_CASE("Filter generator throws exception for empty generator",
+ "[generators]") {
+ using namespace Catch::Generators;
+
+ REQUIRE_THROWS_AS(
+ filter( []( int ) { return false; }, value( 3 ) ),
+ Catch::GeneratorException );
+}