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