forked from ariadne/pkgconf
Add tests for libraries quoted with double quotes, make them pass
parent
b88808f708
commit
d0bbc686bf
|
@ -42,8 +42,10 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
|||
|
||||
while (*src_iter)
|
||||
{
|
||||
if (quote == *src_iter)
|
||||
if (quote == *src_iter) {
|
||||
quote = 0;
|
||||
*dst_iter++ = *src_iter;
|
||||
}
|
||||
else if (quote)
|
||||
{
|
||||
if (*src_iter == '\\')
|
||||
|
@ -81,6 +83,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
|||
case '"':
|
||||
case '\'':
|
||||
quote = *src_iter;
|
||||
*dst_iter++ = *src_iter;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
|
|
|
@ -26,9 +26,21 @@ void test_escaped()
|
|||
pkgconf_argv_free(argv);
|
||||
}
|
||||
|
||||
void test_quoted()
|
||||
{
|
||||
int argc;
|
||||
char **argv;
|
||||
|
||||
pkgconf_argv_split("\"A B\"", &argc, &argv);
|
||||
assert(argc == 1);
|
||||
assert(!strcmp(argv[0], "\"A B\""));
|
||||
pkgconf_argv_free(argv);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void) argc; (void) argv;
|
||||
test_simple();
|
||||
test_escaped();
|
||||
test_quoted();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
prefix=/test
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: framework-3
|
||||
Description: pkg-config with space in framework name
|
||||
Version: 1.3
|
||||
Libs: -F${libdir} -framework "Spacey Framework"
|
|
@ -6,5 +6,5 @@ includedir=${prefix}/include
|
|||
Name: quotes
|
||||
Description: A testing pkg-config file
|
||||
Version: 1.2.3
|
||||
Libs: -L${libdir} -lfoo\ bar
|
||||
Libs: -L${libdir} -lfoo\ bar "-lfoobie bletch"
|
||||
Cflags: -DQUOTED=\"bla\"
|
||||
|
|
|
@ -221,7 +221,7 @@ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --list-all | grep -q 'multiline
|
|||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags quotes" \
|
||||
"-DQUOTED=\\\"bla\\\""
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs quotes" \
|
||||
'-lfoo\ bar'
|
||||
'-lfoo\ bar "-lfoobie bletch"'
|
||||
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs nolib; echo \$?" \
|
||||
'0'
|
||||
|
@ -241,6 +241,8 @@ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-2" \
|
|||
"-F/test/lib -framework framework-2 -framework framework-1"
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-1 framework-2" \
|
||||
"-F/test/lib -framework framework-1 -framework framework-2"
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-3" \
|
||||
'-F/test/lib -framework "Spacey Framework"'
|
||||
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists --print-errors 'foo > 0.6.0 foo < 0.8.0'; echo \$?" \
|
||||
'1'
|
||||
|
|
Loading…
Reference in New Issue