diff options
author | Eric Wong <normalperson@yhbt.net> | 2006-08-05 22:13:54 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2006-08-05 22:13:54 +0000 |
commit | a8393d393705aac995cf24841ce63ecb175b6b4e (patch) | |
tree | 8ff1ae7df3b53461559fa4863bd600530e34471f | |
parent | dd4c6d45f20e0e5ec771263a3227f1f9bc5d3784 (diff) | |
download | mpd-a8393d393705aac995cf24841ce63ecb175b6b4e.tar.gz mpd-a8393d393705aac995cf24841ce63ecb175b6b4e.tar.xz mpd-a8393d393705aac995cf24841ce63ecb175b6b4e.zip |
buffer2array: more unit tests
git-svn-id: https://svn.musicpd.org/mpd/trunk@4570 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r-- | src/buffer2array.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/buffer2array.c b/src/buffer2array.c index ecd01701b..3bdb66547 100644 --- a/src/buffer2array.c +++ b/src/buffer2array.c @@ -81,16 +81,37 @@ int main() max = cstrtok(b, a, 4); assert( !strcmp("lsinfo", a[0]) ); assert( !strcmp("/some/dir/name \"test\"", a[1]) ); + assert( !a[2] ); b = strdup("lsinfo \"/some/dir/name \\\"test\\\" something else\""); max = cstrtok(b, a, 4); assert( !strcmp("lsinfo", a[0]) ); assert( !strcmp("/some/dir/name \"test\" something else", a[1]) ); + assert( !a[2] ); b = strdup("lsinfo \"/some/dir\\\\name\""); max = cstrtok(b, a, 4); assert( !strcmp("lsinfo", a[0]) ); assert( !strcmp("/some/dir\\name", a[1]) ); + assert( !a[2] ); + + b = strdup("lsinfo \"/some/dir name\""); + max = cstrtok(b, a, 4); + assert( !strcmp("lsinfo", a[0]) ); + assert( !strcmp("/some/dir name", a[1]) ); + assert( !a[2] ); + + b = strdup("lsinfo \"\\\"/some/dir\\\"\""); + max = cstrtok(b, a, 4); + assert( !strcmp("lsinfo", a[0]) ); + assert( !strcmp("\"/some/dir\"", a[1]) ); + assert( !a[2] ); + + b = strdup("lsinfo \"\\\"/some/dir\\\" x\""); + max = cstrtok(b, a, 4); + assert( !strcmp("lsinfo", a[0]) ); + assert( !strcmp("\"/some/dir\" x", a[1]) ); + assert( !a[2] ); return 0; } |