hemplate

Simple XML template engine
git clone git://git.dimitrijedobrota.com/hemplate.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

atom_test.cpp (979B)


0 #include "hemplate/atom.hpp"
2 #include <catch2/catch_test_macros.hpp>
4 using namespace hemplate; // NOLINT
6 TEST_CASE("feed", "[atom/feed]")
7 {
8 SECTION("default")
9 {
10 const atom::feed feed;
12 REQUIRE(
13 std::string(feed)
14 == "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n</feed>\n"
15 );
16 }
18 SECTION("custom")
19 {
20 const atom::feed feed {{{"hello", "world"}}};
22 REQUIRE(std::string(feed) == "<feed hello=\"world\">\n</feed>\n");
23 }
24 }
26 TEST_CASE("linkHref", "[atom/linkHref]")
27 {
28 const atom::linkHref link {"url"};
30 REQUIRE(std::string(link) == "<link href=\"url\" />\n");
31 }
33 TEST_CASE("linkSelf", "[atom/linkSelf]")
34 {
35 const atom::linkSelf link {"url"};
37 REQUIRE(std::string(link) == "<link rel=\"self\" href=\"url\" />\n");
38 }
40 TEST_CASE("linkAlternate", "[atom/linkAlternate]")
41 {
42 const atom::linkAlternate link {"url"};
44 REQUIRE(
45 std::string(link)
46 == "<link rel=\"alternate\" type=\"text/html\" href=\"url\" />\n"
47 );
48 }