Commit a981141b authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

unit: make unit test source code checksrc compliant

parent d3252e00
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -88,7 +88,8 @@ extern int unitfail;
    (void)arg;                                  \
    if(unit_setup()) {                          \
      fail("unit_setup() failure");             \
  } else {
    }                                           \
    else {

#define UNITTEST_STOP                           \
    goto unit_test_abort; /* avoid warning */   \
+3 −3
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
+9 −5
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -126,7 +126,8 @@ Curl_safefree(decoded);
size = 1; /* not zero */
decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("aQ", &decoded, &size);
fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
            "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL");

@@ -134,7 +135,8 @@ fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */
decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a===", &decoded, &size);
fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
            "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL");

@@ -142,7 +144,8 @@ fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */
decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a=Q=", &decoded, &size);
fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
            "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL");

@@ -150,7 +153,8 @@ fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */
decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a\x1f==", &decoded, &size);
fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
            "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL");

+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
+13 −9
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -72,7 +72,8 @@ UNITTEST_START
  abort_unless(password != NULL, "returned NULL!");
  fail_unless(password[0] == 0, "password should not have been changed");
  abort_unless(login != NULL, "returned NULL!");
  fail_unless(strncmp(login, "me", 2) == 0, "login should not have been changed");
  fail_unless(strncmp(login, "me", 2) == 0,
              "login should not have been changed");

  /*
   * Test a non existent login and host in our netrc file.
@@ -85,7 +86,8 @@ UNITTEST_START
  abort_unless(password != NULL, "returned NULL!");
  fail_unless(password[0] == 0, "password should not have been changed");
  abort_unless(login != NULL, "returned NULL!");
  fail_unless(strncmp(login, "me", 2) == 0, "login should not have been changed");
  fail_unless(strncmp(login, "me", 2) == 0,
              "login should not have been changed");

  /*
   * Test a non existent login (substring of an existing one) in our
@@ -99,7 +101,8 @@ UNITTEST_START
  abort_unless(password != NULL, "returned NULL!");
  fail_unless(password[0] == 0, "password should not have been changed");
  abort_unless(login != NULL, "returned NULL!");
  fail_unless(strncmp(login, "admi", 4) == 0, "login should not have been changed");
  fail_unless(strncmp(login, "admi", 4) == 0,
              "login should not have been changed");

  /*
   * Test a non existent login (superstring of an existing one)
@@ -113,7 +116,8 @@ UNITTEST_START
  abort_unless(password != NULL, "returned NULL!");
  fail_unless(password[0] == 0, "password should not have been changed");
  abort_unless(login != NULL, "returned NULL!");
  fail_unless(strncmp(login, "adminn", 6) == 0, "login should not have been changed");
  fail_unless(strncmp(login, "adminn", 6) == 0,
              "login should not have been changed");

  /*
   * Test for the first existing host in our netrc file
Loading