From a6960084fbd19c02603d41b9bc8bbeab097efcab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Mon, 29 Jul 2013 15:51:45 -0400 Subject: [PATCH 1/1] lib: fix precision of test_curl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- tests/sav/test_curl.sav | 59 ----------------------------------------------- tests/test_curl.nit | 46 +++--------------------------------- 2 files changed, 3 insertions(+), 102 deletions(-) diff --git a/tests/sav/test_curl.sav b/tests/sav/test_curl.sav index f171aeb..0126379 100644 --- a/tests/sav/test_curl.sav +++ b/tests/sav/test_curl.sav @@ -1,62 +1,3 @@ -* About to connect() to example.org port 80 (#0) -* Trying 192.0.43.10... -* connected -* Connected to example.org (192.0.43.10) port 80 (#0) -> GET / HTTP/1.1 -Host: example.org -Accept: */* - -* additional stuff not fine transfer.c:1037: 0 0 -* HTTP 1.0, assume close after body -< HTTP/1.0 302 Found -< Location: http://example.iana.org -< Server: BigIP -* HTTP/1.0 connection set to keep alive! -< Connection: Keep-Alive -< Content-Length: 0 -< -* Connection #0 to host example.org left intact -GetinfoLong:: Header size: 115 -GetinfoLong:: Response code: 302 -GetinfoLong:: http_connectcode: 0 -GetinfoLong:: filetime: -1 -GetinfoLong:: redirect_count: 0 -GetinfoLong:: request_size: 50 -GetinfoLong:: ssl_verifyresult: 0 -GetinfoLong:: httpauth_avail: 0 -GetinfoLong:: proxyauth_avail: 0 -GetinfoLong:: os_errno: 0 -GetinfoLong:: primary_port: 80 -GetinfoLong:: num_connects: 1 -GetinfoLong:: local_port: 44959 -GetinfoLong:: lastsocket: 4 -GetinfoLong:: condition_unmet: 0 -GetinfoLong:: rtsp_client_cseq: 0 -GetinfoLong:: rtsp_server_cseq: 0 -GetinfoLong:: rtsp_cseq_recv: 0 -GetinfoDouble:: total_time: 0 -GetinfoDouble:: namelookup_time: 0 -GetinfoDouble:: connect_time: 0 -GetinfoDouble:: appconnect_time: 0 -GetinfoDouble:: pretransfer_time: 0 -GetinfoDouble:: starttransfer_time: 0 -GetinfoDouble:: redirect_time: 0 -GetinfoDouble:: size_upload: 0 -GetinfoDouble:: size_download: 0 -GetinfoDouble:: speed_download: 0 -GetinfoDouble:: speed_upload: 0 -GetinfoDouble:: content_length_download: 0 -GetinfoDouble:: content_length_upload: 0 -GetinfoStr:: Content type: -GetinfoStr:: Effective url: http://example.org/ -GetinfoStr:: Redirect url: http://example.iana.org -GetinfoStr:: primary_ip not empty: true -GetinfoStr:: local_ip not empty: true -GetinfoStr:: ftp_entry_path: -GetinfoStr:: private_data: -GetinfoStr:: rtsp_session_id: -GetSList:: ssl_engines: -GetSList:: cookielist: CURLSList to array - content: tititotototo2toto3toto4toto9 CURLSList to array - length: 6 Array to CURLSList - content: tatatata2 diff --git a/tests/test_curl.nit b/tests/test_curl.nit index bc89868..6401706 100644 --- a/tests/test_curl.nit +++ b/tests/test_curl.nit @@ -29,8 +29,9 @@ var error:CURLCode error = curl.easy_setopt(new CURLOption.url, url) error_manager(error) -error = curl.easy_setopt(new CURLOption.verbose, 1) -error_manager(error) +# Activate for advanced debugging +#error = curl.easy_setopt(new CURLOption.verbose, 1) +#error_manager(error) error = curl.easy_perform error_manager(error) @@ -39,173 +40,132 @@ error_manager(error) var info:nullable CURLInfoResponseLong info = curl.easy_getinfo_long(new CURLInfoLong.header_size) assert infoResp:info != null -print "GetinfoLong:: Header size: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.response_code) assert infoResp:info != null -print "GetinfoLong:: Response code: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.http_connectcode) assert infoResp:info != null -print "GetinfoLong:: http_connectcode: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.filetime) assert infoResp:info != null -print "GetinfoLong:: filetime: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.redirect_count) assert infoResp:info != null -print "GetinfoLong:: redirect_count: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.request_size) assert infoResp:info != null -print "GetinfoLong:: request_size: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.ssl_verifyresult) assert infoResp:info != null -print "GetinfoLong:: ssl_verifyresult: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.httpauth_avail) assert infoResp:info != null -print "GetinfoLong:: httpauth_avail: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.proxyauth_avail) assert infoResp:info != null -print "GetinfoLong:: proxyauth_avail: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.os_errno) assert infoResp:info != null -print "GetinfoLong:: os_errno: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.primary_port) assert infoResp:info != null -print "GetinfoLong:: primary_port: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.num_connects) assert infoResp:info != null -print "GetinfoLong:: num_connects: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.local_port) assert infoResp:info != null -print "GetinfoLong:: local_port: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.lastsocket) assert infoResp:info != null -print "GetinfoLong:: lastsocket: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.condition_unmet) assert infoResp:info != null -print "GetinfoLong:: condition_unmet: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.rtsp_client_cseq) assert infoResp:info != null -print "GetinfoLong:: rtsp_client_cseq: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.rtsp_server_cseq) assert infoResp:info != null -print "GetinfoLong:: rtsp_server_cseq: " + info.response.to_s info = curl.easy_getinfo_long(new CURLInfoLong.rtsp_cseq_recv) assert infoResp:info != null -print "GetinfoLong:: rtsp_cseq_recv: " + info.response.to_s # Double var infoDouble: nullable CURLInfoResponseDouble infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.total_time) assert infoResp:infoDouble != null -print "GetinfoDouble:: total_time: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.namelookup_time) assert infoResp:infoDouble != null -print "GetinfoDouble:: namelookup_time: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.connect_time) assert infoResp:infoDouble != null -print "GetinfoDouble:: connect_time: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.appconnect_time) assert infoResp:infoDouble != null -print "GetinfoDouble:: appconnect_time: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.pretransfer_time) assert infoResp:infoDouble != null -print "GetinfoDouble:: pretransfer_time: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.starttransfer_time) assert infoResp:infoDouble != null -print "GetinfoDouble:: starttransfer_time: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.redirect_time) assert infoResp:infoDouble != null -print "GetinfoDouble:: redirect_time: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.size_upload) assert infoResp:infoDouble != null -print "GetinfoDouble:: size_upload: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.size_download) assert infoResp:infoDouble != null -print "GetinfoDouble:: size_download: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.speed_download) assert infoResp:infoDouble != null -print "GetinfoDouble:: speed_download: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.speed_upload) assert infoResp:infoDouble != null -print "GetinfoDouble:: speed_upload: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.content_length_download) assert infoResp:infoDouble != null -print "GetinfoDouble:: content_length_download: " + infoDouble.response.to_s infoDouble = curl.easy_getinfo_double(new CURLInfoDouble.content_length_upload) assert infoResp:infoDouble != null -print "GetinfoDouble:: content_length_upload: " + infoDouble.response.to_s # String set var infoStr:nullable CURLInfoResponseString infoStr = curl.easy_getinfo_chars(new CURLInfoChars.content_type) assert infoResp:infoStr != null -print "GetinfoStr:: Content type: " + infoStr.response infoStr = curl.easy_getinfo_chars(new CURLInfoChars.effective_url) assert infoResp:infoStr != null -print "GetinfoStr:: Effective url: " + infoStr.response infoStr = curl.easy_getinfo_chars(new CURLInfoChars.redirect_url) assert infoResp:infoStr != null -print "GetinfoStr:: Redirect url: " + infoStr.response infoStr = curl.easy_getinfo_chars(new CURLInfoChars.primary_ip) assert infoResp:infoStr != null -print( "GetinfoStr:: primary_ip not empty: " + (not infoStr.response.is_empty).to_s) infoStr = curl.easy_getinfo_chars(new CURLInfoChars.local_ip) assert infoResp:infoStr != null -print( "GetinfoStr:: local_ip not empty: " + (not infoStr.response.is_empty).to_s) infoStr = curl.easy_getinfo_chars(new CURLInfoChars.ftp_entry_path) assert infoResp:infoStr != null -print "GetinfoStr:: ftp_entry_path: " + infoStr.response infoStr = curl.easy_getinfo_chars(new CURLInfoChars.private_data) assert infoResp:infoStr != null -print "GetinfoStr:: private_data: " + infoStr.response infoStr = curl.easy_getinfo_chars(new CURLInfoChars.rtsp_session_id) assert infoResp:infoStr != null -print "GetinfoStr:: rtsp_session_id: " + infoStr.response # CURLSList set var infoList:nullable CURLInfoResponseArray infoList = curl.easy_getinfo_slist(new CURLInfoSList.ssl_engines) assert infoResp:infoList != null -print "GetSList:: ssl_engines: " + infoList.response.to_s infoList = curl.easy_getinfo_slist(new CURLInfoSList.cookielist) assert infoResp:infoList != null -print "GetSList:: cookielist: " + infoList.response.to_s # CURLSList to Array var mailList = new CURLSList.with_str("titi") -- 1.7.9.5