• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mbits-os / quick_dra / 22038263728

15 Feb 2026 03:31PM UTC coverage: 93.378% (+6.4%) from 87.008%
22038263728

Pull #39

github

web-flow
Merge 74a89bbd4 into 7d773e4d9
Pull Request #39: testing

58 of 67 new or added lines in 23 files covered. (86.57%)

75 existing lines in 12 files now uncovered.

4033 of 4319 relevant lines covered (93.38%)

1107.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

51.85
/libs/libpersist/src/ref.cpp
1
// Copyright (c) 2026 midnightBITS
2
// This code is licensed under MIT license (see LICENSE for details)
3

4
#include <fmt/format.h>
5
#include <yaml/ref.hpp>
6

7
using namespace std::literals;
8

9
namespace yaml {
10
        namespace {
11
                thread_local struct base_ctx::error_handler* head = nullptr;
12

13
                void c4_error_handler(const char* msg,
14
                                      size_t msg_len,
15
                                      c4::yml::Location loc,
16
                                      void* user_data) {
UNCOV
17
                        reinterpret_cast<base_ctx::error_handler*>(user_data)->handle_error(
×
18
                            loc, std::string_view{msg, msg_len});
19
                        throw c4_error_exception{};
×
20
                }
21
        }  // namespace
22

23
        base_ctx::error_handler::error_handler() : prev{head} { head = this; }
178✔
24
        base_ctx::error_handler::~error_handler() { head = prev; }
178✔
25

26
        void base_ctx::error_handler::install_in_c4() {
178✔
27
                c4::yml::Callbacks callbacks;
532✔
28
                callbacks.m_user_data = this;
532✔
29
                callbacks.m_error = c4_error_handler;
532✔
30
                c4::yml::set_callbacks(callbacks);
532✔
31
        }
532✔
32

33
        bool base_ctx::error_handler::handle_msg(c4::yml::Location const& loc,
34
                                                 std::string_view msg,
35
                                                 std::string_view level) {
36
                if (!loc.name.empty()) {
UNCOV
37
                        fmt::print(stderr, "{}:", view(loc.name));
×
38
                }
UNCOV
39
                fmt::print(stderr, "{}:{}: {}: {}\n", loc.line + 1, loc.col + 1, level,
×
40
                           msg);
41

42
                auto stack = this;
×
43
                while (stack) {
UNCOV
44
                        stack->parse_succeeded = false;
×
45
                        stack = stack->prev;
×
46
                }
47

48
                return false;
×
49
        }
50

51
        bool base_ctx::error_handler::handle_error(c4::yml::Location const& loc,
52
                                                   std::string_view msg) {
UNCOV
53
                return handle_msg(loc, msg, "error"sv);
×
54
        }
55

56
        ref_ctx base_ctx::from(ryml::ConstNodeRef const& ref) const {
6,343✔
57
                return {
12,685✔
58
                    {.parser = parser},
19,026✔
59
                    &ref,
12,684✔
60
                };
19,026✔
61
        }
12,685✔
62

63
        bool ref_ctx::error(std::string_view const& msg) const {
64
                if (parser && parser->source().len && ref_ && head) {
UNCOV
65
                        return head->handle_error(ref_->location(*parser), msg);
×
66
                }
67
                fmt::print(stderr, "error: {}\n", msg);
UNCOV
68
                return false;
×
69
        }
70

71
        void ref_ctx::warn(std::string_view const& msg) const {
72
                if (parser && ref_ && head) {
NEW
73
                        head->handle_msg(ref_->location(*parser), msg, "warning"sv);
×
NEW
74
                        return;
×
75
                }
76
                fmt::print(stderr, "warning: {}\n", msg);
77
        }
78
}  // namespace yaml
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc