return url.url();
}
+
+QString Kita::unescape( const QString& str )
+{
+ QString ret = str;
+ return ret.replace( "<", "<" ).replace( ">", ">" ).replace( "&", "&" );
+}
QString subjectToBoard( const QString& subjectURL );
QString datToCache( const QString& datURL );
QString httpToK2ch( const QString& httpURL );
+ QString unescape( const QString& str );
};
#endif
KDE_CXXFLAGS = $(USE_EXCEPTIONS)
test_libkita_LDADD = $(top_builddir)/kita/src/libkita/libkita.la -lkio -lqt-mt -lcppunit
-test_libkita_SOURCES = test_libkita.cpp k2ch_articlefiletest.cpp urlconverttest.cpp commenttest.cpp threadtest.cpp boardtest.cpp
-noinst_HEADERS = k2ch_articlefiletest.h urlconverttest.h commenttest.h threadtest.h boardtest.h
+test_libkita_SOURCES = test_libkita.cpp k2ch_articlefiletest.cpp urlconverttest.cpp commenttest.cpp threadtest.cpp boardtest.cpp misctest.cpp
+noinst_HEADERS = k2ch_articlefiletest.h urlconverttest.h commenttest.h threadtest.h boardtest.h misctest.h
--- /dev/null
+/***************************************************************************
+* Copyright (C) 2003 by Hideki Ikemoto *
+* ikemo@wakaba.jp *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+***************************************************************************/
+
+#include "misctest.h"
+
+void MiscTest::setUp()
+{}
+
+void MiscTest::tearDown()
+{}
+
+void MiscTest::testUnEscape()
+{
+ CPPUNIT_ASSERT_EQUAL( QString( "&" ), Kita::unescape( "&" ) );
+ CPPUNIT_ASSERT_EQUAL( QString( "<" ), Kita::unescape( "<" ) );
+ CPPUNIT_ASSERT_EQUAL( QString( ">" ), Kita::unescape( ">" ) );
+ CPPUNIT_ASSERT_EQUAL( QString( "<" ), Kita::unescape( "&lt;" ) );
+}
--- /dev/null
+/***************************************************************************
+* Copyright (C) 2003 by Hideki Ikemoto *
+* ikemo@wakaba.jp *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+***************************************************************************/
+
+#ifndef MISCTEST_H
+#define MISCTEST_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include "../kita_misc.h"
+
+/**
+@author Hideki Ikemoto
+*/
+class MiscTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE( MiscTest );
+ CPPUNIT_TEST( testUnEscape );
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void setUp();
+ void tearDown();
+
+ void testUnEscape();
+};
+
+#endif
#include "commenttest.h"
#include "threadtest.h"
#include "boardtest.h"
+#include "misctest.h"
int main( int argc, char* argv[] )
{
runner.addTest( CommentTest::suite() );
runner.addTest( ThreadTest::suite() );
runner.addTest( BoardTest::suite() );
+ runner.addTest( MiscTest::suite() );
runner.run( "" );
return 0;
}