This commit is contained in:
Brent Simmons 2024-05-21 17:53:41 -07:00
commit 6df9d1a45f
6 changed files with 40 additions and 18 deletions

View File

@ -56,6 +56,7 @@
"parallelizable" : true, "parallelizable" : true,
"target" : { "target" : {
"containerPath" : "container:", "containerPath" : "container:",
<<<<<<< HEAD
"identifier" : "FeedlyTests", "identifier" : "FeedlyTests",
"name" : "FeedlyTests" "name" : "FeedlyTests"
} }
@ -66,6 +67,10 @@
"containerPath" : "container:", "containerPath" : "container:",
"identifier" : "AccountTests", "identifier" : "AccountTests",
"name" : "AccountTests" "name" : "AccountTests"
=======
"identifier" : "WebTests",
"name" : "WebTests"
>>>>>>> 72e83becb1becceba3c41a747d377a7bfab51bf4
} }
} }
], ],

View File

@ -1,5 +1,5 @@
{ {
"originHash" : "59328e75653678265f96b3e73fe970261384ed8254eaf879de4d37bf88c50409", "originHash" : "2079e49cc55bbf9be4182c1dcc315cf7f9fb85bb8df8872cfbf587882e37a80e",
"pins" : [ "pins" : [
{ {
"identity" : "plcrashreporter", "identity" : "plcrashreporter",

View File

@ -1,5 +1,5 @@
// //
// Dictionary+RSWeb.swift // Dictionary+Web.swift
// RSWeb // RSWeb
// //
// Created by Brent Simmons on 1/13/18. // Created by Brent Simmons on 1/13/18.
@ -13,12 +13,13 @@ public extension Dictionary where Key == String, Value == String {
/// Translates a dictionary into a string like `foo=bar&param2=some%20thing`. /// Translates a dictionary into a string like `foo=bar&param2=some%20thing`.
var urlQueryString: String? { var urlQueryString: String? {
var components = URLComponents() var queryItems = [URLQueryItem]()
for (key, value) in self {
components.queryItems = self.reduce(into: [URLQueryItem]()) { queryItems.append(URLQueryItem(name: key, value: value))
$0.append(URLQueryItem(name: $1.key, value: $1.value))
} }
var components = URLComponents()
components.queryItems = queryItems
let s = components.percentEncodedQuery let s = components.percentEncodedQuery
return s == nil || s!.isEmpty ? nil : s return s == nil || s!.isEmpty ? nil : s

View File

@ -0,0 +1,20 @@
//
// DictionaryWebTests.swift
//
//
// Created by Brent Simmons on 5/20/24.
//
import XCTest
import Web
final class DictionaryWebTests: XCTestCase {
func testURLQueryString_oneItemNoEscaping() {
let d = ["parameterName" : "value"]
let queryString = d.urlQueryString
let expectedQueryString = "parameterName=value"
XCTAssertEqual(queryString, expectedQueryString)
}
}

View File

@ -1,12 +0,0 @@
import XCTest
@testable import Web
final class WebTests: XCTestCase {
func testExample() throws {
// XCTest Documentation
// https://developer.apple.com/documentation/xctest
// Defining Test Cases and Test Methods
// https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
}
}

View File

@ -59,6 +59,14 @@
"identifier" : "518B2ED12351B3DD00400001", "identifier" : "518B2ED12351B3DD00400001",
"name" : "NetNewsWire-iOSTests" "name" : "NetNewsWire-iOSTests"
} }
},
{
"parallelizable" : true,
"target" : {
"containerPath" : "container:",
"identifier" : "WebTests",
"name" : "WebTests"
}
} }
], ],
"version" : 1 "version" : 1