Archetype: cpp_service_stub_test.cpp.mustache

Table of Contents

Placeholder Catch2 test keeping the tests target linking. component-service profile.

See the Template variable reference for the complete list of available variables and their semantics.

Template

The full template source. Edit here and re-tangle with compass build --direct tangle_codegen_templates to regenerate library/templates/cpp_service_stub_test.cpp.mustache.

{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/cpp_service_app.org. Edit the org source. }}
{{{cpp_license}}}
{{#component}}
#include "{{full_name}}/config/parser.hpp"

#include <sstream>
#include <vector>
#include <string>
#include <catch2/catch_test_macros.hpp>
#include "{{full_name}}/config/parser_exception.hpp"

namespace {

const std::string_view test_suite("{{full_name}}.tests");
const std::string tags("[config]");

}

using namespace {{namespace}}::config;

TEST_CASE("parse_help_does_not_throw", tags) {
    std::ostringstream out, err;
    parser p;
    const auto r(p.parse({"--help"}, out, err));
    REQUIRE(!r);
}

TEST_CASE("parse_version_does_not_throw", tags) {
    std::ostringstream out, err;
    parser p;
    const auto r(p.parse({"--version"}, out, err));
    REQUIRE(!r);
}
{{/component}}

See also

Emacs 29.1 (Org mode 9.6.6)