testURL.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#include "squid.h"
10
11#include <cppunit/TestAssert.h>
12
13#include "anyp/Uri.h"
14#include "debug/Stream.h"
15#include "tests/testURL.h"
16#include "unitTestMain.h"
17
18#include <sstream>
19
21
22/* init memory pools */
23
24void
26{
27 Mem::Init();
29}
30
31/*
32 * we can construct a URL with a AnyP::UriScheme.
33 * This creates a URL for that scheme.
34 */
35void
37{
38 AnyP::UriScheme empty_scheme;
39 AnyP::Uri protoless_url(AnyP::PROTO_NONE);
40 CPPUNIT_ASSERT_EQUAL(empty_scheme, protoless_url.getScheme());
41
44 CPPUNIT_ASSERT_EQUAL(ftp_scheme, ftp_url.getScheme());
45}
46
47/*
48 * a default constructed URL has scheme "NONE".
49 * Also, we should be able to use new and delete on
50 * scheme instances.
51 */
52void
54{
55 AnyP::UriScheme aScheme;
56 AnyP::Uri aUrl;
57 CPPUNIT_ASSERT_EQUAL(aScheme, aUrl.getScheme());
58
59 auto *urlPointer = new AnyP::Uri;
60 CPPUNIT_ASSERT(urlPointer != nullptr);
61 delete urlPointer;
62}
63
static void Init()
initializes down-cased protocol scheme names array
Definition: UriScheme.cc:38
Definition: Uri.h:31
AnyP::UriScheme const & getScheme() const
Definition: Uri.h:67
void testDefaultConstructor()
Definition: testURL.cc:53
void setUp()
Definition: testURL.cc:25
void testConstructScheme()
Definition: testURL.cc:36
@ PROTO_NONE
Definition: ProtocolType.h:24
@ PROTO_FTP
Definition: ProtocolType.h:26
void Init()
Definition: old_api.cc:425
CPPUNIT_TEST_SUITE_REGISTRATION(testURL)

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors