Files
textmate/Frameworks/text/tests/t_decode.cc
2013-08-29 13:26:16 +02:00

21 lines
980 B
C++
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include <text/decode.h>
void test_decode ()
{
OAK_ASSERT_EQ(decode::entities("Hello world"), "Hello world");
OAK_ASSERT_EQ(decode::entities("Hello&nbsp;world"), "Hello world");
OAK_ASSERT_EQ(decode::entities("Hello &quot;world&quot;"), "Hello \"world\"");
OAK_ASSERT_EQ(decode::entities("Hello &lt;world&gt;"), "Hello <world>");
OAK_ASSERT_EQ(decode::entities("Hello &lt-world&gt;"), "Hello &lt-world>");
OAK_ASSERT_EQ(decode::entities("Hello &lt;world&gt-"), "Hello <world&gt-");
OAK_ASSERT_EQ(decode::entities("&AElig;blegr&oslash;d&hellip;"), "Æblegrød…");
}
void test_decode_url ()
{
OAK_ASSERT_EQ(decode::url_part("ActionScript%203%2BR.tbz"), "ActionScript 3+R.tbz");
OAK_ASSERT_EQ(decode::url_part("%C3%86blegr%C3%B8d"), "Æblegrød");
OAK_ASSERT_EQ(decode::url_part("foo%2Bbar"), "foo+bar");
OAK_ASSERT_EQ(decode::url_part("foo+bar"), "foo bar");
}