diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2018-07-23 21:42:00 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2018-07-23 21:42:00 -0700 |
commit | a09abace8d4ec0d2fc9bb65493dfae7b7ce8e0fe (patch) | |
tree | f264e91c74d2e033c4e8474e377c9af36ac5c6f9 /test | |
parent | c2dade7a5a0b4e8317e8eb6f249cef91eb54cc1a (diff) |
Add copy constructor and assignment operator
Diffstat (limited to 'test')
-rw-r--r-- | test/src/UriTests.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp index d8dca7a..72d9f72 100644 --- a/test/src/UriTests.cpp +++ b/test/src/UriTests.cpp @@ -872,3 +872,26 @@ TEST(UriTests, QueryEmptyButPresent) { ASSERT_EQ("", uri.GetQuery()); ASSERT_EQ("http://example.com/?", uri.GenerateString()); } + +TEST(UriTests, MakeACopy) { + Uri::Uri uri1; + (void)uri1.ParseFromString("http://www.example.com/foo.txt"); + Uri::Uri uri2(uri1); + uri1.SetQuery("bar"); + uri2.SetFragment("page2"); + uri2.SetHost("example.com"); + EXPECT_EQ("http://www.example.com/foo.txt?bar", uri1.GenerateString()); + EXPECT_EQ("http://example.com/foo.txt#page2", uri2.GenerateString()); +} + +TEST(UriTests, AssignACopy) { + Uri::Uri uri1; + (void)uri1.ParseFromString("http://www.example.com/foo.txt"); + Uri::Uri uri2; + uri2 = uri1; + uri1.SetQuery("bar"); + uri2.SetFragment("page2"); + uri2.SetHost("example.com"); + EXPECT_EQ("http://www.example.com/foo.txt?bar", uri1.GenerateString()); + EXPECT_EQ("http://example.com/foo.txt#page2", uri2.GenerateString()); +} |