failtest: report failpath problems correctly.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 29 Nov 2011 22:45:11 +0000 (09:15 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 29 Nov 2011 22:45:11 +0000 (09:15 +1030)
It was the wrong way around, and also it's better to show the whole
remaining failpath rather than the current letter.

ccan/failtest/failtest.c

index 56ace7431847c5ac9fd059b77d4b9271958a3fb7..a0c825399d03881ab0338075a0a46fb2c4ec1898 100644 (file)
@@ -518,8 +518,8 @@ static bool should_fail(struct failtest_call *call)
                } else {
                        if (tolower((unsigned char)*failpath)
                            != info_to_arg[call->type])
                } else {
                        if (tolower((unsigned char)*failpath)
                            != info_to_arg[call->type])
-                               errx(1, "Failpath expected '%c' got '%c'\n",
-                                    info_to_arg[call->type], *failpath);
+                               errx(1, "Failpath expected '%s' got '%c'\n",
+                                    failpath, info_to_arg[call->type]);
                        call->fail = cisupper(*(failpath++));
                        return call->fail;
                }
                        call->fail = cisupper(*(failpath++));
                        return call->fail;
                }