Revert "Merge pull request #81 from dankegel/quotefest"

This reverts commit 42551f6364, reversing
changes made to 938bb9e694.
feature/tap-sh
William Pitcock 2015-09-27 16:07:06 -05:00
parent 6a66b52190
commit abbd6b06d4
6 changed files with 3 additions and 71 deletions

View File

@ -24,7 +24,6 @@ EXTRA_DIST = \
tests/lib1/prefix-foo2.pc \ tests/lib1/prefix-foo2.pc \
tests/lib1/bar.pc \ tests/lib1/bar.pc \
tests/lib1/framework-2.pc \ tests/lib1/framework-2.pc \
tests/lib1/framework-3.pc \
tests/lib1/private-libs-duplication.pc \ tests/lib1/private-libs-duplication.pc \
tests/lib1/baz.pc \ tests/lib1/baz.pc \
tests/lib1/incomplete.pc \ tests/lib1/incomplete.pc \
@ -77,12 +76,7 @@ dist_doc_DATA = README.md AUTHORS
m4datadir = $(datadir)/aclocal m4datadir = $(datadir)/aclocal
m4data_DATA = pkg.m4 m4data_DATA = pkg.m4
EXTRA_PROGRAMS = unit_tests
unit_tests_SOURCES = libpkgconf/tests/argvsplit-test.c
unit_tests_LDADD = libpkgconf.la
CLEANFILES = $(EXTRA_PROGRAMS) CLEANFILES = $(EXTRA_PROGRAMS)
check: pkgconf unit_tests check: pkgconf
./unit_tests
$(SHELL) tests/run.sh ./pkgconf $(SHELL) tests/run.sh ./pkgconf

View File

@ -42,10 +42,8 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
while (*src_iter) while (*src_iter)
{ {
if (quote == *src_iter) { if (quote == *src_iter)
quote = 0; quote = 0;
*dst_iter++ = *src_iter;
}
else if (quote) else if (quote)
{ {
if (*src_iter == '\\') if (*src_iter == '\\')
@ -83,7 +81,6 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
case '"': case '"':
case '\'': case '\'':
quote = *src_iter; quote = *src_iter;
*dst_iter++ = *src_iter;
break; break;
case '\\': case '\\':

View File

@ -1,46 +0,0 @@
#include <stdio.h>
#include <assert.h>
#include "../libpkgconf.h"
void test_simple()
{
int argc;
char **argv;
pkgconf_argv_split("A B", &argc, &argv);
assert(argc == 2);
assert(!strcmp(argv[0], "A"));
assert(!strcmp(argv[1], "B"));
pkgconf_argv_free(argv);
}
void test_escaped()
{
int argc;
char **argv;
pkgconf_argv_split("A\\ B", &argc, &argv);
assert(argc == 1);
assert(!strcmp(argv[0], "A\\ B"));
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();
}

View File

@ -1,9 +0,0 @@
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"

View File

@ -6,5 +6,5 @@ includedir=${prefix}/include
Name: quotes Name: quotes
Description: A testing pkg-config file Description: A testing pkg-config file
Version: 1.2.3 Version: 1.2.3
Libs: -L${libdir} -lfoo\ bar "-lfoobie bletch" Libs: -L${libdir} -lfoo
Cflags: -DQUOTED=\"bla\" Cflags: -DQUOTED=\"bla\"

View File

@ -220,8 +220,6 @@ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --list-all | grep -q 'multiline
# test quoted #35 # test quoted #35
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags quotes" \ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags quotes" \
"-DQUOTED=\\\"bla\\\"" "-DQUOTED=\\\"bla\\\""
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs quotes" \
'-lfoo\ bar "-lfoobie bletch"'
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs nolib; echo \$?" \ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs nolib; echo \$?" \
'0' '0'
@ -241,8 +239,6 @@ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-2" \
"-F/test/lib -framework framework-2 -framework framework-1" "-F/test/lib -framework framework-2 -framework framework-1"
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-1 framework-2" \ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-1 framework-2" \
"-F/test/lib -framework framework-1 -framework 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 \$?" \ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists --print-errors 'foo > 0.6.0 foo < 0.8.0'; echo \$?" \
'1' '1'