From 5a5bb7f63222189ea0dcfbd387d5e34458ccefe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 14 Dec 2016 18:28:44 +0100 Subject: Introduce a XmlSubNode class that automatically adds itself into its parent --- tests/xmpp.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/xmpp.cpp') diff --git a/tests/xmpp.cpp b/tests/xmpp.cpp index 37d2b54..42b7c08 100644 --- a/tests/xmpp.cpp +++ b/tests/xmpp.cpp @@ -52,3 +52,20 @@ TEST_CASE("handshake_digest") const auto res = get_handshake_digest("id1234", "S4CR3T"); CHECK(res == "c92901b5d376ad56269914da0cce3aab976847df"); } + +TEST_CASE("substanzas") +{ + Stanza a("a"); + { + XmlSubNode b(a, "b"); + { + CHECK(!a.has_children()); + XmlSubNode c(b, "c"); + XmlSubNode d(b, "d"); + CHECK(!c.has_children()); + CHECK(!d.has_children()); + } + CHECK(b.has_children()); + } + CHECK(a.has_children()); +} \ No newline at end of file -- cgit v1.2.3 From 5402a256d1f0ebbeafa32d250d000cf38fe748fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 7 Apr 2017 18:45:24 +0200 Subject: Apply all the clang-tidy modernize-* fixes --- tests/xmpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/xmpp.cpp') diff --git a/tests/xmpp.cpp b/tests/xmpp.cpp index 42b7c08..7ea03a9 100644 --- a/tests/xmpp.cpp +++ b/tests/xmpp.cpp @@ -43,7 +43,7 @@ TEST_CASE("Test basic XML parsing") TEST_CASE("XML escape") { - const std::string unescaped = "'coucou'/&\"gaga\""; + const std::string unescaped = R"('coucou'/&"gaga")"; CHECK(xml_escape(unescaped) == "'coucou'<cc>/&"gaga""); } -- cgit v1.2.3 From cf1c8f188c64ffe6cce941027190ef3cd90abf6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 21 May 2017 12:23:10 +0200 Subject: Remove a few warnings occuring in some build config --- tests/xmpp.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/xmpp.cpp') diff --git a/tests/xmpp.cpp b/tests/xmpp.cpp index 7ea03a9..14c51da 100644 --- a/tests/xmpp.cpp +++ b/tests/xmpp.cpp @@ -30,15 +30,16 @@ TEST_CASE("Test basic XML parsing") // And do the same checks on moved-constructed stanza Stanza moved(std::move(copy)); }); - xml.feed(doc.data(), doc.size(), true); + CHECK(doc.size() <= std::numeric_limits::max()); + xml.feed(doc.data(), static_cast(doc.size()), true); const std::string doc2 = "coucou\r\n\a"; xml.add_stanza_callback([](const Stanza& stanza) { CHECK(stanza.get_inner() == "coucou\r\n"); }); - - xml.feed(doc2.data(), doc.size(), true); + CHECK(doc.size() <= std::numeric_limits::max()); + xml.feed(doc2.data(), static_cast(doc.size()), true); } TEST_CASE("XML escape") @@ -68,4 +69,4 @@ TEST_CASE("substanzas") CHECK(b.has_children()); } CHECK(a.has_children()); -} \ No newline at end of file +} -- cgit v1.2.3