pEpForiOSTests/StringExtensionsTest.swift
author Dirk Zimmermann <dirk@pep-project.org>
Wed, 13 Jul 2016 10:04:19 +0200
changeset 425 b6fb20724534
child 426 32a6fd67ada0
permissions -rw-r--r--
Simple, basic mechanism to search for contacts in compose. Needs work.
dirk@425
     1
//
dirk@425
     2
//  StringExtensionsTest.swift
dirk@425
     3
//  pEpForiOS
dirk@425
     4
//
dirk@425
     5
//  Created by Dirk Zimmermann on 13/07/16.
dirk@425
     6
//  Copyright © 2016 p≡p Security S.A. All rights reserved.
dirk@425
     7
//
dirk@425
     8
dirk@425
     9
import XCTest
dirk@425
    10
dirk@425
    11
import pEpForiOS
dirk@425
    12
dirk@425
    13
class StringExtensionsTest: XCTestCase {
dirk@425
    14
    func testTrimWhiteSpace() {
dirk@425
    15
        XCTAssertEqual("".trimmedWhiteSpace(), "")
dirk@425
    16
        XCTAssertEqual("    abc".trimmedWhiteSpace(), "abc")
dirk@425
    17
        XCTAssertEqual("    abc\t".trimmedWhiteSpace(), "abc")
dirk@425
    18
        XCTAssertEqual("    abc \t ".trimmedWhiteSpace(), "abc")
dirk@425
    19
        XCTAssertEqual("abc   ".trimmedWhiteSpace(), "abc")
dirk@425
    20
        XCTAssertEqual(" finished2".trimmedWhiteSpace(), "finished2")
dirk@425
    21
    }
dirk@425
    22
dirk@425
    23
    func testFinishedRecipientPart() {
dirk@425
    24
        XCTAssertEqual("unfinis".finishedRecipientPart(), "")
dirk@425
    25
        XCTAssertEqual("finished1,".finishedRecipientPart(), "finished1")
dirk@425
    26
        XCTAssertEqual("finished, unfinis".finishedRecipientPart(), "finished")
dirk@425
    27
        XCTAssertEqual("finished1, finished2, unfinis".finishedRecipientPart(),
dirk@425
    28
                       "finished1, finished2")
dirk@425
    29
        XCTAssertEqual("finished1, finished2, finished3, non terminado".finishedRecipientPart(),
dirk@425
    30
                       "finished1, finished2, finished3")
dirk@425
    31
    }
dirk@425
    32
}