]> granicus.if.org Git - curl/commitdiff
test 1511: fix enumerated type mixed with another type
authorYang Tse <yangsita@gmail.com>
Thu, 11 Jul 2013 15:01:02 +0000 (17:01 +0200)
committerYang Tse <yangsita@gmail.com>
Thu, 11 Jul 2013 15:01:02 +0000 (17:01 +0200)
tests/data/test1511
tests/libtest/lib1511.c

index 947ad26da46f41af850c2e8e625e088610ca47fe..b52bd1fb0060abe659ebe22c4122054bb3fdb6cd 100644 (file)
@@ -59,4 +59,12 @@ HTTP GET time conditions in repeated requests
 http://%HOSTIP:%HTTPPORT/1511
 </command>
 </client>
+
+# Verify data after the test has been "shot"
+# TEST_ERR_SUCCESS is errorcode 120
+<verify>
+<errorcode>
+120
+</errorcode>
+</verify>
 </testcase>
index c75a8c2712b66ef9f634b5db4ea729b840757aff..a46f9ab5bf5f0a2addfe5bd36141e02002ec90bd 100644 (file)
  ***************************************************************************/
 #include "test.h"
 
-#include "testtrace.h"
 #include "memdebug.h"
 
 int test(char *URL)
 {
-  int i = -1;
   long unmet;
-  CURLcode res = 0;
   CURL* curl = NULL;
+  int res = 0;
 
   global_init(CURL_GLOBAL_ALL);
+
   easy_init(curl);
 
   easy_setopt(curl, CURLOPT_URL, URL);
   easy_setopt(curl, CURLOPT_HEADER, 1L);
-  easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
+  easy_setopt(curl, CURLOPT_TIMECONDITION, (long)CURL_TIMECOND_IFMODSINCE);
 
   /* TIMEVALUE in the future */
-  easy_setopt(curl, CURLOPT_TIMEVALUE, 1566210680);
+  easy_setopt(curl, CURLOPT_TIMEVALUE, 1566210680L);
 
   res = curl_easy_perform(curl);
-  if(res != CURLE_OK)
+  if(res)
     goto test_cleanup;
 
   curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
-  if(unmet != 1)
+  if(unmet != 1L) {
+    res = TEST_ERR_FAILURE; /* not correct */
     goto test_cleanup;
+  }
 
   /* TIMEVALUE in the past */
-  easy_setopt(curl, CURLOPT_TIMEVALUE, 1);
+  easy_setopt(curl, CURLOPT_TIMEVALUE, 1L);
 
   res = curl_easy_perform(curl);
-  if (res != CURLE_OK)
+  if(res)
     goto test_cleanup;
 
   curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
-  if(unmet != 0)
+  if(unmet != 0L) {
+    res = TEST_ERR_FAILURE; /* not correct */
     goto test_cleanup;
+  }
 
-  i = 0;
+  res = TEST_ERR_SUCCESS; /* this is where we should be */
 
 test_cleanup:
-  if(res)
-    i = res;
 
+  /* always cleanup */
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return i; /* return the final return code */
+  return res;
 }