2018-01-14 02:40:27 +01:00
|
|
|
//
|
|
|
|
// StringTests.swift
|
|
|
|
// RSWebTests
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 1/13/18.
|
|
|
|
// Copyright © 2018 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import XCTest
|
|
|
|
|
|
|
|
class StringTests: XCTestCase {
|
|
|
|
|
|
|
|
func testURLQueryEncoding() {
|
|
|
|
|
|
|
|
var s = "foo".encodedForURLQuery()
|
|
|
|
XCTAssertEqual(s, "foo")
|
|
|
|
|
|
|
|
s = "foo bar".encodedForURLQuery()
|
2018-01-14 20:11:53 +01:00
|
|
|
XCTAssertEqual(s, "foo%20bar")
|
2018-01-14 02:40:27 +01:00
|
|
|
|
|
|
|
s = "foo bar &well".encodedForURLQuery()
|
2018-01-14 20:11:53 +01:00
|
|
|
XCTAssertEqual(s, "foo%20bar%20%38well")
|
2018-01-14 02:40:27 +01:00
|
|
|
}
|
|
|
|
}
|