-
Notifications
You must be signed in to change notification settings - Fork 8
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 #7 from NextFaze/feature/swift4
Feature/swift4
- Loading branch information
Showing
8 changed files
with
109 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0 | ||
4.0 |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,67 @@ | ||
// | ||
// Copyright 2017 NextFaze | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
// use this file except in compliance with the License. You may obtain a copy | ||
// of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
// License for the specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
// StringAdditionsTests.swift | ||
// FazeKit_Tests | ||
// | ||
// Created by Ricardo Santos on 19/12/17. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
import FazeKit | ||
|
||
class StringAdditionsTests: XCTestCase { | ||
|
||
override func setUp() { | ||
super.setUp() | ||
} | ||
|
||
override func tearDown() { | ||
super.tearDown() | ||
} | ||
|
||
func testContains() { | ||
let string = "Abcdefgh" | ||
XCTAssertTrue(string.contains("A"), "String.contains: should have found a match") | ||
XCTAssertFalse(string.contains("a"), "String.contains: should not have found a match") | ||
XCTAssertFalse(string.contains("z"), "String.contains: should not have found a match") | ||
} | ||
|
||
func testReplace() { | ||
var string = "The cat jumped over the hat" | ||
string = string.replace("cat", withString: "dog") | ||
XCTAssertTrue(string.contains("dog"), "String.replace: should contain the replacement substring") | ||
XCTAssertFalse(string.contains("cat"), "String.replace: should not still contain the original substring") | ||
} | ||
|
||
func testSubscript() { | ||
let string = "OMG. I can't believe it's a thing!" | ||
XCTAssertTrue(string[0] == "O", "String.subscript: should return the Character O") | ||
XCTAssertTrue(string[1] == "M", "String.subscript: should return the Character M") | ||
XCTAssertTrue(string[2] == "G", "String.subscript: should return the Character G") | ||
} | ||
|
||
func testSubstring() { | ||
let string = "OMG. Is this even a thing?" | ||
XCTAssertTrue(string.substring(0, length: 3) == "OMG", "String.substring: should create a new substring") | ||
} | ||
|
||
func testTrim() { | ||
let string = " Hello World \n\n\n " | ||
XCTAssertTrue(string.trim() == "Hello World", "String.trim(): should remove all whitespace and newlines") | ||
} | ||
|
||
} |
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
Oops, something went wrong.