#include "greatest.h" #include #include #include "src/markup.h" TEST test_markup_strip(void) { char *ptr; ASSERT_STR_EQ(""", (ptr=markup_strip(g_strdup("&quot;")))); g_free(ptr); ASSERT_STR_EQ("'", (ptr=markup_strip(g_strdup("&apos;")))); g_free(ptr); ASSERT_STR_EQ("<", (ptr=markup_strip(g_strdup("&lt;")))); g_free(ptr); ASSERT_STR_EQ(">", (ptr=markup_strip(g_strdup("&gt;")))); g_free(ptr); ASSERT_STR_EQ("&", (ptr=markup_strip(g_strdup("&amp;")))); g_free(ptr); ASSERT_STR_EQ(">A ", (ptr=markup_strip(g_strdup(">A foo
bar\nbaz"), MARKUP_NO))); g_free(ptr); ASSERT_STR_EQ("foo\nbar\nbaz", (ptr=markup_transform(g_strdup("foo
bar\nbaz"), MARKUP_STRIP))); g_free(ptr); ASSERT_STR_EQ("foo\nbar\nbaz", (ptr=markup_transform(g_strdup("foo
bar\nbaz"), MARKUP_FULL))); g_free(ptr); settings.ignore_newline = true; ASSERT_STR_EQ("<i>foo</i><br>bar baz", (ptr=markup_transform(g_strdup("foo
bar\nbaz"), MARKUP_NO))); g_free(ptr); ASSERT_STR_EQ("foo bar baz", (ptr=markup_transform(g_strdup("foo
bar\nbaz"), MARKUP_STRIP))); g_free(ptr); ASSERT_STR_EQ("foo bar baz", (ptr=markup_transform(g_strdup("foo
bar\nbaz"), MARKUP_FULL))); g_free(ptr); PASS(); } SUITE(suite_markup) { RUN_TEST(test_markup_strip); RUN_TEST(test_markup_transform); } /* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */