Skip to content

Commit

Permalink
Add a CustomStringConvertible test
Browse files Browse the repository at this point in the history
  • Loading branch information
karwa committed Nov 18, 2021
1 parent 72e1b8a commit 3c98e77
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Tests/WebURLTests/WebURLTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ class WebURLTests: XCTestCase {}
// --------------------------------------------


extension WebURLTests {

func testCustomStringConvertible() {
// String.init(WebURL) should include the fragment. Is the same as calling .serialized()
do {
let url = WebURL("http://example.com/some/path?and&a&query#withAFragment")!
XCTAssertEqual(url.serialized(), "http://example.com/some/path?and&a&query#withAFragment")
XCTAssertEqual(String(url), url.serialized())
XCTAssertEqual(url.description, url.serialized())

XCTAssertEqual(url.serialized(excludingFragment: true), "http://example.com/some/path?and&a&query")
XCTAssertNotEqual(url.serialized(), url.serialized(excludingFragment: true))
}
}
}

#if swift(>=5.5) && canImport(_Concurrency)

extension WebURLTests {
Expand Down

0 comments on commit 3c98e77

Please sign in to comment.