summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-07-31 15:57:14 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-07-31 16:11:26 (EDT)
commit3ecd9acbc96a4798901e55599ca7fce195085994 (patch)
treeff8acb466cc5bf634fc1d691b73df3c77fd1f6a7 /tests
parent5fe0ebd51de4eba549df3172fb0a4be32585be3b (diff)
dirent: Add function to allocate & build long nameHEADmaster
And add test cases. Based on code from commit 42156fbb5d41e2360336c32365e89b14fe5b01ca, which was removed in commit bceab75f6330f82e55381c49026878e3a339a984.
Diffstat (limited to 'tests')
-rw-r--r--tests/dirent.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/dirent.c b/tests/dirent.c
index de20b86..bb84cf5 100644
--- a/tests/dirent.c
+++ b/tests/dirent.c
@@ -40,8 +40,9 @@ main()
};
char name[9];
char pref[4];
+ char *full_name;
- puts("1..2");
+ puts("1..4");
if (opkg_opk_dirent_name_prefix(&baz, 0, name, sizeof(name),
pref, sizeof(pref)) != OPKG_OPK_OK ||
@@ -59,5 +60,19 @@ main()
}
printf("ok 2 - \"%s\" + \"%s\"\n", pref, name);
+ full_name = opkg_opk_dirent_name_alloc(&baz, 0);
+ if (full_name == NULL || strcmp(full_name, "foo/bar/baz") != 0) {
+ fputs("not ", stdout);
+ }
+ printf("ok 3 - \"%s\"\n", full_name);
+ free(full_name);
+
+ full_name = opkg_opk_dirent_name_alloc(&baz, 1);
+ if (full_name == NULL || strcmp(full_name, "foo/bar/baz/") != 0) {
+ fputs("not ", stdout);
+ }
+ printf("ok 4 - \"%s\"\n", full_name);
+ free(full_name);
+
return EXIT_SUCCESS;
}