Files
textmate/Frameworks/text/tests/t_decode.cc
Allan Odgaard 9894969e67 Initial commit
2012-08-09 16:25:56 +02:00

23 lines
935 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>
class DecodeTests : public CxxTest::TestSuite
{
public:
void test_decode ()
{
TS_ASSERT_EQUALS(decode::entities("Hello world"), "Hello world");
TS_ASSERT_EQUALS(decode::entities("Hello&nbsp;world"), "Hello world");
TS_ASSERT_EQUALS(decode::entities("Hello &quot;world&quot;"), "Hello \"world\"");
TS_ASSERT_EQUALS(decode::entities("Hello &lt;world&gt;"), "Hello <world>");
TS_ASSERT_EQUALS(decode::entities("Hello &lt-world&gt;"), "Hello &lt-world>");
TS_ASSERT_EQUALS(decode::entities("Hello &lt;world&gt-"), "Hello <world&gt-");
TS_ASSERT_EQUALS(decode::entities("&AElig;blegr&oslash;d&hellip;"), "Æblegrød…");
}
void test_decode_url ()
{
TS_ASSERT_EQUALS(decode::url_part("ActionScript%203%2BR.tbz"), "ActionScript 3+R.tbz");
TS_ASSERT_EQUALS(decode::url_part("%C3%86blegr%C3%B8d"), "Æblegrød");
}
};