This repository has been archived by the owner on Jul 8, 2019. It is now read-only.
forked from FormatterKit/FormatterKit
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
109 additions
and
0 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
44 changes: 44 additions & 0 deletions
44
Example/Tests-Chinese-Simplified/ArrayFormatterTests.swift
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,44 @@ | ||
// | ||
// ArrayFormatterTests.swift | ||
// FormatterKit Example | ||
// | ||
// Created by Victor Ilyukevich on 5/14/16. | ||
// Copyright © 2016. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
import FormatterKit | ||
|
||
class ArrayFormatterTests: XCTestCase { | ||
|
||
var formatter: TTTArrayFormatter! | ||
|
||
let dogCatParrot = ["狗", "猫", "鹦鹉"] | ||
|
||
override func setUp() { | ||
super.setUp() | ||
formatter = TTTArrayFormatter() | ||
} | ||
|
||
// MARK: Tests | ||
|
||
func testDefault() { | ||
let result = formatter.stringFromArray(dogCatParrot) | ||
let expected = "狗、猫、及鹦鹉" | ||
|
||
XCTAssertEqual(result, expected) | ||
// TODO | ||
// XCTAssertEqual(formatter.arrayFromString(expected) as! [String], dogCatParrot) | ||
} | ||
|
||
func testAbbreviatedConjunction() { | ||
formatter.usesAbbreviatedConjunction = true | ||
|
||
let result = formatter.stringFromArray(dogCatParrot) | ||
let expected = "狗、猫、和鹦鹉" | ||
|
||
XCTAssertEqual(result, expected) | ||
// TODO | ||
// XCTAssertEqual(formatter.arrayFromString(expected) as! [String], dogCatParrot) | ||
} | ||
} |
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,57 @@ | ||
// | ||
// ArrayFormatterTests.swift | ||
// FormatterKit Example | ||
// | ||
// Created by Victor Ilyukevich on 5/14/16. | ||
// Copyright © 2016. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
import FormatterKit | ||
|
||
class ArrayFormatterTests: XCTestCase { | ||
|
||
var formatter: TTTArrayFormatter! | ||
|
||
let dogCatParrot = ["Dog", "Cat", "Parrot"] | ||
|
||
override func setUp() { | ||
super.setUp() | ||
formatter = TTTArrayFormatter() | ||
} | ||
|
||
// MARK: Tests | ||
|
||
func testDefault() { | ||
let result = formatter.stringFromArray(dogCatParrot) | ||
let expected = "Dog, Cat, and Parrot" | ||
|
||
XCTAssertEqual(result, expected) | ||
// TODO | ||
// XCTAssertEqual(formatter.arrayFromString(expected) as! [String], dogCatParrot) | ||
} | ||
|
||
func testAbbreviatedConjunction() { | ||
formatter.usesAbbreviatedConjunction = true | ||
|
||
let result = formatter.stringFromArray(dogCatParrot) | ||
let expected = "Dog, Cat, & Parrot" | ||
|
||
XCTAssertEqual(result, expected) | ||
// TODO | ||
// XCTAssertEqual(formatter.arrayFromString(expected) as! [String], dogCatParrot) | ||
|
||
} | ||
|
||
func testWithoutOxformComma() { | ||
formatter.usesSerialDelimiter = false | ||
|
||
let result = formatter.stringFromArray(dogCatParrot) | ||
let expected = "Dog, Cat and Parrot" | ||
|
||
XCTAssertEqual(result, expected) | ||
// TODO | ||
// XCTAssertEqual(formatter.arrayFromString(expected) as! [String], dogCatParrot) | ||
} | ||
|
||
} |