Skip to content

Commit

Permalink
Make sure that passing non-existent names doesn't break
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Jan 8, 2025
1 parent 95eaafa commit 3a0abf8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/read_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,22 @@ int test_read_frame_limited(ReaderT& reader) {
return 1;
}

// Check that nothing breaks if we pass in an unavailable collection name
const auto emptyEvent = [&]() {
if constexpr (std::is_same_v<ReaderT, podio::Reader>) {
return podio::Frame(reader.readFrame("events", 1, {"no-collection-with-this-name", "orThisOne"}));
} else {
return podio::Frame(reader.readEntry("events", 1, {"no-collection-with-this-name", "orThisOne"}));
}
}();

if (!emptyEvent.getAvailableCollections().empty()) {
std::cerr << "Trying to read collection names that are unavailable should not break, but should also not give a "
"meaningful event"
<< std::endl;
return 1;
}

return 0;
}

Expand Down

0 comments on commit 3a0abf8

Please sign in to comment.