Annotation of embedaddon/curl/tests/unit/unit1620.c, revision 1.1

1.1     ! misho       1: /***************************************************************************
        !             2:  *                                  _   _ ____  _
        !             3:  *  Project                     ___| | | |  _ \| |
        !             4:  *                             / __| | | | |_) | |
        !             5:  *                            | (__| |_| |  _ <| |___
        !             6:  *                             \___|\___/|_| \_\_____|
        !             7:  *
        !             8:  * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
        !             9:  *
        !            10:  * This software is licensed as described in the file COPYING, which
        !            11:  * you should have received as part of this distribution. The terms
        !            12:  * are also available at https://curl.haxx.se/docs/copyright.html.
        !            13:  *
        !            14:  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
        !            15:  * copies of the Software, and permit persons to whom the Software is
        !            16:  * furnished to do so, under the terms of the COPYING file.
        !            17:  *
        !            18:  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
        !            19:  * KIND, either express or implied.
        !            20:  *
        !            21:  ***************************************************************************/
        !            22: #include "curlcheck.h"
        !            23: 
        !            24: #include "urldata.h"
        !            25: #include "url.h"
        !            26: 
        !            27: #include "memdebug.h" /* LAST include file */
        !            28: 
        !            29: static CURLcode unit_setup(void)
        !            30: {
        !            31:   return CURLE_OK;
        !            32: }
        !            33: 
        !            34: static void unit_stop(void)
        !            35: {
        !            36: }
        !            37: 
        !            38: UNITTEST_START
        !            39: {
        !            40:   int rc;
        !            41:   struct Curl_easy *empty;
        !            42:   const char *hostname = "hostname";
        !            43:   enum dupstring i;
        !            44: 
        !            45:   bool async = FALSE;
        !            46:   bool protocol_connect = FALSE;
        !            47: 
        !            48:   rc = Curl_open(&empty);
        !            49:   if(rc)
        !            50:     goto unit_test_abort;
        !            51:   fail_unless(rc == CURLE_OK, "Curl_open() failed");
        !            52: 
        !            53:   rc = Curl_connect(empty, &async, &protocol_connect);
        !            54:   fail_unless(rc == CURLE_URL_MALFORMAT,
        !            55:               "Curl_connect() failed to return CURLE_URL_MALFORMAT");
        !            56: 
        !            57:   fail_unless(empty->magic == CURLEASY_MAGIC_NUMBER,
        !            58:               "empty->magic should be equal to CURLEASY_MAGIC_NUMBER");
        !            59: 
        !            60:   /* double invoke to ensure no dependency on internal state */
        !            61:   rc = Curl_connect(empty, &async, &protocol_connect);
        !            62:   fail_unless(rc == CURLE_URL_MALFORMAT,
        !            63:               "Curl_connect() failed to return CURLE_URL_MALFORMAT");
        !            64: 
        !            65:   rc = Curl_init_userdefined(empty);
        !            66:   fail_unless(rc == CURLE_OK, "Curl_userdefined() failed");
        !            67: 
        !            68:   rc = Curl_init_do(empty, empty->conn);
        !            69:   fail_unless(rc == CURLE_OK, "Curl_init_do() failed");
        !            70: 
        !            71:   rc = Curl_parse_login_details(
        !            72:                           hostname, strlen(hostname), NULL, NULL, NULL);
        !            73:   fail_unless(rc == CURLE_OK,
        !            74:               "Curl_parse_login_details() failed");
        !            75: 
        !            76:   rc = Curl_disconnect(empty, empty->conn, FALSE);
        !            77:   fail_unless(rc == CURLE_OK,
        !            78:               "Curl_disconnect() with dead_connection set FALSE failed");
        !            79: 
        !            80:   Curl_freeset(empty);
        !            81:   for(i = (enum dupstring)0; i < STRING_LAST; i++) {
        !            82:     fail_unless(empty->set.str[i] == NULL,
        !            83:                 "Curl_free() did not set to NULL");
        !            84:   }
        !            85: 
        !            86:   Curl_free_request_state(empty);
        !            87: 
        !            88:   rc = Curl_close(&empty);
        !            89:   fail_unless(rc == CURLE_OK, "Curl_close() failed");
        !            90: 
        !            91: }
        !            92: UNITTEST_STOP

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>