From e5f2f399994ba41f0978960050fc6c4cc3e41c8a Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Sun, 27 Oct 2024 16:41:47 +0100 Subject: [PATCH] Avoid global variable in test --- test/t/io/test_reader_with_mock_decompression.cpp | 4 ++-- test/t/io/test_writer_with_mock_compression.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/t/io/test_reader_with_mock_decompression.cpp b/test/t/io/test_reader_with_mock_decompression.cpp index 6248d8b2..ebb73eee 100644 --- a/test/t/io/test_reader_with_mock_decompression.cpp +++ b/test/t/io/test_reader_with_mock_decompression.cpp @@ -76,10 +76,10 @@ class MockDecompressor final : public osmium::io::Decompressor { }; // class MockDecompressor -std::string fail_in; - TEST_CASE("Test Reader using MockDecompressor") { + std::string fail_in; + osmium::io::CompressionFactory::instance().register_compression(osmium::io::file_compression::gzip, [](int /*unused*/, osmium::io::fsync /*unused*/) { return nullptr; }, [&](int /*unused*/) { return new MockDecompressor(fail_in); }, diff --git a/test/t/io/test_writer_with_mock_compression.cpp b/test/t/io/test_writer_with_mock_compression.cpp index ff2a8436..17857d53 100644 --- a/test/t/io/test_writer_with_mock_compression.cpp +++ b/test/t/io/test_writer_with_mock_compression.cpp @@ -46,10 +46,10 @@ class MockCompressor final : public osmium::io::Compressor { }; // class MockCompressor -std::string fail_in; - TEST_CASE("Write with mock compressor") { + std::string fail_in; + osmium::io::CompressionFactory::instance().register_compression(osmium::io::file_compression::gzip, [&](int /*unused*/, osmium::io::fsync /*unused*/) { return new MockCompressor(fail_in); }, [](int /*unused*/) { return nullptr; },