Skip to content

Commit 60a5244

Browse files
committedMar 16, 2025
Exclude some unimplemented methods from lcov
1 parent ecfe599 commit 60a5244

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed
 

‎src/osmchange_responder.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ struct sorting_formatter : public output_formatter {
5252

5353
~sorting_formatter() override = default;
5454

55+
// LCOV_EXCL_START
56+
5557
[[nodiscard]] mime::type mime_type() const override {
5658
throw std::runtime_error("sorting_formatter::mime_type unimplemented");
5759
}
@@ -91,6 +93,8 @@ struct sorting_formatter : public output_formatter {
9193
throw std::runtime_error("sorting_formatter::end_changeset unimplemented");
9294
}
9395

96+
// LCOV_EXCL_STOP
97+
9498
void write_node(
9599
const element_info &elem,
96100
double lon, double lat,
@@ -127,6 +131,8 @@ struct sorting_formatter : public output_formatter {
127131
m_elements.emplace_back(std::move(rel));
128132
}
129133

134+
// LCOV_EXCL_START
135+
130136
void write_changeset(
131137
const changeset_info &,
132138
const tags_t &,
@@ -172,6 +178,8 @@ struct sorting_formatter : public output_formatter {
172178
throw std::runtime_error("Unexpected call to end_action.");
173179
}
174180

181+
// LCOV_EXCL_STOP
182+
175183
void write(output_formatter &fmt) {
176184
std::sort(m_elements.begin(), m_elements.end());
177185
for (const auto &e : m_elements) {

‎src/text_formatter.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ text_formatter::text_formatter(std::unique_ptr<text_writer> w) : writer(std::mov
1616

1717
mime::type text_formatter::mime_type() const { return mime::type::text_plain; }
1818

19+
// LCOV_EXCL_START
20+
1921
void text_formatter::start_document(
2022
const std::string &generator, const std::string &root_name) {
2123
// nothing needed here
@@ -51,11 +53,6 @@ void text_formatter::end_action(action_type type) {
5153
// nothing needed here
5254
}
5355

54-
void text_formatter::error(const std::exception &e) {
55-
56-
writer->text(e.what());
57-
}
58-
5956
void text_formatter::write_tags(const tags_t &) {
6057
// nothing needed here
6158
}
@@ -96,15 +93,19 @@ void text_formatter::write_diffresult_create_modify(const element_type elem,
9693
// nothing needed here
9794
}
9895

99-
10096
void text_formatter::write_diffresult_delete(const element_type elem,
10197
const osm_nwr_signed_id_t old_id)
10298
{
10399
// nothing needed here
104100
}
105101

106-
102+
// LCOV_EXCL_STOP
107103

108104
void text_formatter::flush() { writer->flush(); }
109105

110106
void text_formatter::error(const std::string &s) { writer->error(s); }
107+
108+
void text_formatter::error(const std::exception &e) {
109+
110+
writer->text(e.what());
111+
}

‎test/test_formatter.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ bool test_formatter::changeset_t::operator==(const changeset_t &other) const {
8181
(!m_include_comments || m_comments == other.m_comments);
8282
}
8383

84+
// LCOV_EXCL_START
85+
8486
mime::type test_formatter::mime_type() const {
8587
throw std::runtime_error("Unimplemented");
8688
}
@@ -113,6 +115,8 @@ void test_formatter::start_action(action_type type) {
113115
void test_formatter::end_action(action_type type) {
114116
}
115117

118+
// LCOV_EXCL_STOP
119+
116120
void test_formatter::write_node(const element_info &elem, double lon, double lat,
117121
const tags_t &tags) {
118122
m_nodes.emplace_back(elem, lon, lat, tags);

0 commit comments

Comments
 (0)