Skip to content

Commit

Permalink
Avoid global variable in test
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Oct 27, 2024
1 parent 6bd166b commit e5f2f39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/t/io/test_reader_with_mock_decompression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); },
Expand Down
4 changes: 2 additions & 2 deletions test/t/io/test_writer_with_mock_compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; },
Expand Down

0 comments on commit e5f2f39

Please sign in to comment.