-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from lewis-smith/master
Moved to stringByAddingPercentEncodingWithAllowedCharacters
- Loading branch information
Showing
8 changed files
with
258 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// String+SwifterTests.swift | ||
// Swifter | ||
// | ||
// Created by Lewis Smith on 20/02/2016. | ||
// Copyright © 2016 Matt Donnelly. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
|
||
@testable import SwifteriOS | ||
|
||
class String_SwifterTests: XCTestCase { | ||
|
||
|
||
override func setUp() { | ||
|
||
super.setUp() | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
|
||
} | ||
|
||
override func tearDown() { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
super.tearDown() | ||
} | ||
|
||
func testEncoding() { | ||
|
||
let shouldBeTheSameAfterEncoding = [ | ||
"a": "a", | ||
"a a": "a%20a", | ||
".": ".", | ||
"[": "[", | ||
"]": "]", | ||
"'": "%27", | ||
"$": "%24", | ||
"&": "%26", | ||
"<": "%3C", | ||
">": "%3E", | ||
"?": "%3F", | ||
";": "%3B", | ||
"#": "%23", | ||
":": "%3A", | ||
"=": "%3D", | ||
",": "%2C", | ||
"\"": "%22", | ||
"+": "%2B", | ||
"%": "%25", | ||
":/?&=;+!@# ()',*": "%3A%2F%3F%26%3D%3B%2B%21%40%23%20%28%29%27%2C%2A", | ||
"http://a?a=[a,b]": "http%3A%2F%2Fa%3Fa%3D[a%2Cb]" | ||
] | ||
|
||
let shouldBeDifferentAfterEcoding = [ | ||
"a": "b", | ||
"a a": "a a", | ||
"$": "$" | ||
] | ||
|
||
for (input, output) in shouldBeTheSameAfterEncoding { | ||
XCTAssertEqual(input.urlEncodedStringWithEncoding(), output, input) | ||
} | ||
|
||
|
||
for (input, output) in shouldBeDifferentAfterEcoding { | ||
XCTAssertNotEqual(input.urlEncodedStringWithEncoding(), output) | ||
} | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.