enhance completion unit test
authorOlivier Matz <zer0@droids-corp.org>
Fri, 30 Mar 2018 20:24:01 +0000 (22:24 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Fri, 30 Mar 2018 20:24:01 +0000 (22:24 +0200)
lib/ecoli_complete.c

index 815b825..7ad846c 100644 (file)
@@ -681,6 +681,18 @@ static int ec_comp_testcase(void)
                c != NULL && ec_comp_count(c, EC_COMP_ALL) == 2,
                "complete count should is not 2\n");
 
+       f = open_memstream(&buf, &buflen);
+       if (f == NULL)
+               goto fail;
+       ec_comp_dump(f, NULL);
+       fclose(f);
+       f = NULL;
+
+       testres |= EC_TEST_CHECK(
+               strstr(buf, "no completion"), "bad dump\n");
+       free(buf);
+       buf = NULL;
+
        f = open_memstream(&buf, &buflen);
        if (f == NULL)
                goto fail;
@@ -688,8 +700,10 @@ static int ec_comp_testcase(void)
        fclose(f);
        f = NULL;
 
-       /* testres |= EC_TEST_CHECK( */
-       /*      strstr(buf, "no match"), "bad dump\n"); */
+       testres |= EC_TEST_CHECK(
+               strstr(buf, "comp=<xx>"), "bad dump\n");
+       testres |= EC_TEST_CHECK(
+               strstr(buf, "comp=<yy>"), "bad dump\n");
        free(buf);
        buf = NULL;