X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-c-strcasestr.c;h=e3ff0e286059094bdfa757cde2413533389f8194;hb=0edd3615919bbf744bdb56a59cf736f36a020b9b;hp=683bfe78f2b2f5e4735e2cfb86ba51260d1d2b52;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/tests/test-c-strcasestr.c b/tests/test-c-strcasestr.c index 683bfe78f..e3ff0e286 100644 --- a/tests/test-c-strcasestr.c +++ b/tests/test-c-strcasestr.c @@ -1,5 +1,5 @@ /* Test of case-insensitive searching in a string. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ if (!(expr)) \ { \ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + fflush (stderr); \ abort (); \ } \ } \ @@ -62,6 +63,12 @@ main () ASSERT (result == NULL); } + { + const char input[] = "ABC ABCDAB ABCDABCDABDE"; + const char *result = c_strcasestr (input, "ABCDaBCD"); + ASSERT (result == input + 11); + } + /* Check that a very long haystack is handled quickly if the needle is short and occurs near the beginning. */ { @@ -130,10 +137,8 @@ main () result = c_strcasestr (haystack, needle); ASSERT (result == haystack + m); } - if (needle != NULL) - free (needle); - if (haystack != NULL) - free (haystack); + free (needle); + free (haystack); } return 0;