mirror of
https://github.com/aria2/aria2.git
synced 2026-04-02 18:59:20 +00:00
Rewritten SharedHandle. Now copy constructor taking raw pointer has keyword explicit and SharedHandle's default constructor initializes its internal obj to null, old implementation initializes it using obj's default constructor. To assign null, write SharedHandle<T> x(...); x.reset(); TODO: test/SharedHandleTest.cc needs more tests. * src/SharedHandle.h
44 lines
960 B
C++
44 lines
960 B
C++
#include "HelpItem.h"
|
|
#include <sstream>
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
namespace aria2 {
|
|
|
|
class HelpItemTest:public CppUnit::TestFixture {
|
|
|
|
CPPUNIT_TEST_SUITE(HelpItemTest);
|
|
CPPUNIT_TEST(testToString);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
private:
|
|
|
|
public:
|
|
void setUp() {}
|
|
|
|
void testToString();
|
|
};
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION(HelpItemTest);
|
|
|
|
void HelpItemTest::testToString()
|
|
{
|
|
std::string usage =
|
|
" -m, --max-tries=N Set number of tries. 0 means unlimited.";
|
|
HelpItem item("max-tries", usage, "5");
|
|
item.setAvailableValues("0,5,10");
|
|
item.addTag("basic");
|
|
item.addTag("http");
|
|
item.addTag("ftp");
|
|
|
|
std::stringstream s;
|
|
s << item.toString();
|
|
|
|
CPPUNIT_ASSERT_EQUAL(usage+"\n"+
|
|
" Available Values: 0,5,10\n"
|
|
" Default: 5\n"
|
|
" Tags: basic,http,ftp",
|
|
s.str());
|
|
}
|
|
|
|
} // namespace aria2
|