ArchiveLookup: return const strings

This commit is contained in:
Max Kellermann
2013-10-17 00:35:58 +02:00
parent e132d10aec
commit 1b8a1d4140
4 changed files with 12 additions and 8 deletions

View File

@@ -23,7 +23,7 @@ public:
void
ArchiveLookupTest::TestArchiveLookup()
{
char *archive, *inpath, *suffix;
const char *archive, *inpath, *suffix;
char *path = strdup("");
CPPUNIT_ASSERT_EQUAL(false,
@@ -48,16 +48,16 @@ ArchiveLookupTest::TestArchiveLookup()
path = strdup("Makefile/foo/bar");
CPPUNIT_ASSERT_EQUAL(true,
archive_lookup(path, &archive, &inpath, &suffix));
CPPUNIT_ASSERT_EQUAL(path, archive);
CPPUNIT_ASSERT_EQUAL((const char *)path, archive);
CPPUNIT_ASSERT_EQUAL(0, strcmp(archive, "Makefile"));
CPPUNIT_ASSERT_EQUAL(0, strcmp(inpath, "foo/bar"));
CPPUNIT_ASSERT_EQUAL((char *)nullptr, suffix);
CPPUNIT_ASSERT_EQUAL((const char *)nullptr, suffix);
g_free(path);
path = strdup("config.h/foo/bar");
CPPUNIT_ASSERT_EQUAL(true,
archive_lookup(path, &archive, &inpath, &suffix));
CPPUNIT_ASSERT_EQUAL(path, archive);
CPPUNIT_ASSERT_EQUAL((const char *)path, archive);
CPPUNIT_ASSERT_EQUAL(0, strcmp(archive, "config.h"));
CPPUNIT_ASSERT_EQUAL(0, strcmp(inpath, "foo/bar"));
CPPUNIT_ASSERT_EQUAL(0, strcmp(suffix, "h"));