]> git.ozlabs.org Git - ccan/blobdiff - ccan/strset/test/run.c
strset: set errno on strset_add failures.
[ccan] / ccan / strset / test / run.c
index 557c7080aaba6af5939c97b53df4435db5df9e97..cfda0ee38f0ce998a16c5779fc793d8bf0722565 100644 (file)
@@ -10,7 +10,7 @@ int main(void)
        char *dup = strdup(str);
 
        /* This is how many tests you plan to run */
-       plan_tests(24);
+       plan_tests(26);
 
        strset_init(&set);
 
@@ -25,6 +25,10 @@ int main(void)
        ok1(strset_test(&set, dup));
        ok1(!strset_test(&set, none));
 
+       /* Add of duplicate should fail. */
+       ok1(!strset_set(&set, dup));
+       ok1(errno == EEXIST);
+
        /* Delete should return original string. */
        ok1(strset_clear(&set, dup) == str);
        ok1(!strset_test(&set, str));