Skip to content

Commit 6fbb2a4

Browse files
author
Jim Luther
committed
Fixed indentation in changes. Fixed availability in test.
1 parent a7d3efd commit 6fbb2a4

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

stdlib/public/SDK/Foundation/URLComponents.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,14 @@ public struct URLComponents : ReferenceConvertible, Hashable, Equatable, _Mutabl
291291
set { _applyMutation { $0.queryItems = newValue } }
292292
}
293293

294-
/// Returns an array of query items for this `URLComponents`, in the order in which they appear in the original query string. Any percent-encoding in a query item name or value is retained
295-
///
296-
/// The setter combines an array containing any number of `URLQueryItem`s, each of which represents a single key-value pair, into a query string and sets the `URLComponents` query property. This property assumes the query item names and values are already correctly percent-encoded, and that the query item names do not contain the query item delimiter characters '&' and '='. Attempting to set an incorrectly percent-encoded query item or a query item name with the query item delimiter characters '&' and '=' will cause a `fatalError`.
297-
@available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)
298-
public var percentEncodedQueryItems: [URLQueryItem]? {
299-
get { return _handle.map { $0.percentEncodedQueryItems } }
300-
set { _applyMutation { $0.percentEncodedQueryItems = newValue } }
301-
}
294+
/// Returns an array of query items for this `URLComponents`, in the order in which they appear in the original query string. Any percent-encoding in a query item name or value is retained
295+
///
296+
/// The setter combines an array containing any number of `URLQueryItem`s, each of which represents a single key-value pair, into a query string and sets the `URLComponents` query property. This property assumes the query item names and values are already correctly percent-encoded, and that the query item names do not contain the query item delimiter characters '&' and '='. Attempting to set an incorrectly percent-encoded query item or a query item name with the query item delimiter characters '&' and '=' will cause a `fatalError`.
297+
@available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)
298+
public var percentEncodedQueryItems: [URLQueryItem]? {
299+
get { return _handle.map { $0.percentEncodedQueryItems } }
300+
set { _applyMutation { $0.percentEncodedQueryItems = newValue } }
301+
}
302302

303303
public var hashValue: Int {
304304
return _handle.map { $0.hash }

test/stdlib/TestURL.swift

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -204,44 +204,44 @@ class TestURL : TestURLSuper {
204204
expectEqual("global|nav", first.value)
205205
}
206206

207-
if #available(OSX 10.13, iOS 11.0, *) {
208-
components.percentEncodedQuery = "name1%E2%80%A2=value1%E2%80%A2&name2%E2%80%A2=value2%E2%80%A2"
209-
var qi = components.queryItems!
210-
expectNotNil(qi)
211-
212-
expectEqual(2, qi.count)
213-
214-
expectEqual("name1•", qi[0].name)
215-
expectNotNil(qi[0].value)
216-
expectEqual("value1•", qi[0].value)
217-
218-
expectEqual("name2•", qi[1].name)
219-
expectNotNil(qi[1].value)
220-
expectEqual("value2•", qi[1].value)
221-
222-
qi = components.percentEncodedQueryItems!
223-
expectNotNil(qi)
224-
225-
expectEqual(2, qi.count)
226-
227-
expectEqual("name1%E2%80%A2", qi[0].name)
228-
expectNotNil(qi[0].value)
229-
expectEqual("value1%E2%80%A2", qi[0].value)
230-
231-
expectEqual("name2%E2%80%A2", qi[1].name)
232-
expectNotNil(qi[0].value)
233-
expectEqual("value2%E2%80%A2", qi[1].value)
234-
235-
qi[0].name = "%E2%80%A2name1"
236-
qi[0].value = "%E2%80%A2value1"
237-
qi[1].name = "%E2%80%A2name2"
238-
qi[1].value = "%E2%80%A2value2"
239-
240-
components.percentEncodedQueryItems = qi
241-
242-
expectEqual("%E2%80%A2name1=%E2%80%A2value1&%E2%80%A2name2=%E2%80%A2value2", components.percentEncodedQuery)
243-
}
244-
}
207+
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
208+
components.percentEncodedQuery = "name1%E2%80%A2=value1%E2%80%A2&name2%E2%80%A2=value2%E2%80%A2"
209+
var qi = components.queryItems!
210+
expectNotNil(qi)
211+
212+
expectEqual(2, qi.count)
213+
214+
expectEqual("name1•", qi[0].name)
215+
expectNotNil(qi[0].value)
216+
expectEqual("value1•", qi[0].value)
217+
218+
expectEqual("name2•", qi[1].name)
219+
expectNotNil(qi[1].value)
220+
expectEqual("value2•", qi[1].value)
221+
222+
qi = components.percentEncodedQueryItems!
223+
expectNotNil(qi)
224+
225+
expectEqual(2, qi.count)
226+
227+
expectEqual("name1%E2%80%A2", qi[0].name)
228+
expectNotNil(qi[0].value)
229+
expectEqual("value1%E2%80%A2", qi[0].value)
230+
231+
expectEqual("name2%E2%80%A2", qi[1].name)
232+
expectNotNil(qi[0].value)
233+
expectEqual("value2%E2%80%A2", qi[1].value)
234+
235+
qi[0].name = "%E2%80%A2name1"
236+
qi[0].value = "%E2%80%A2value1"
237+
qi[1].name = "%E2%80%A2name2"
238+
qi[1].value = "%E2%80%A2value2"
239+
240+
components.percentEncodedQueryItems = qi
241+
242+
expectEqual("%E2%80%A2name1=%E2%80%A2value1&%E2%80%A2name2=%E2%80%A2value2", components.percentEncodedQuery)
243+
}
244+
}
245245

246246
func testURLResourceValues() {
247247

0 commit comments

Comments
 (0)