From c808cd624af4fadaf7bedec3115bed00f302d852 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 15 Apr 2010 19:27:47 +0000 Subject: [PATCH] (trunk libT) #3134 "transmission-remote apparently can't handle apostrophes in errorStrings" -- I'm unable to reproduce the reported behavior, but that's no reason to let a new unit test go to waste... committing the unit test anyway --- libtransmission/json-test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/libtransmission/json-test.c b/libtransmission/json-test.c index c8fa59329..ab7b16e1a 100644 --- a/libtransmission/json-test.c +++ b/libtransmission/json-test.c @@ -153,6 +153,26 @@ test2( void ) return 0; } +static int +test3( void ) +{ + const char * in = "{ \"error\": 2," + " \"errorString\": \"torrent not registered with this tracker 6UHsVW'*C\"," + " \"eta\": 262792," + " \"id\": 25," + " \"leftUntilDone\": 2275655680 }"; + tr_benc top; + const char * str; + + const int err = tr_jsonParse( NULL, in, strlen( in ), &top, NULL ); + check( !err ); + check( tr_bencDictFindStr( &top, "errorString", &str ) ); + check( !strcmp( str, "torrent not registered with this tracker 6UHsVW'*C" ) ); + + tr_bencFree( &top ); + return 0; +} + int main( void ) { @@ -167,6 +187,9 @@ main( void ) if( ( i = test2( ) ) ) return i; + if( ( i = test3( ) ) ) + return i; + return 0; }