Skip to content

Commit

Permalink
Relocate localization tests to correct test file
Browse files Browse the repository at this point in the history
  • Loading branch information
James White committed Mar 29, 2016
1 parent a581e70 commit 733f96f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 44 deletions.
45 changes: 44 additions & 1 deletion Tests/AcknowExampleTests/AcknowListViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import XCTest

import AcknowList
@testable import AcknowList

class AcknowListViewControllerTests: XCTestCase {

Expand All @@ -24,4 +24,47 @@ class AcknowListViewControllerTests: XCTestCase {
let cell = viewController.tableView(viewController.tableView, cellForRowAtIndexPath: NSIndexPath(forRow: 0, inSection: 0))
XCTAssertEqual(cell.textLabel?.text, "AcknowList")
}

func testLocalizedStringReturnsEnglish() {

class MockAcknowListViewController: AcknowListViewController {

override class func preferredLanguageCode() -> String {
return "en-GB"
}
}

XCTAssertEqual("Acknowledgements", MockAcknowListViewController.localizedString(forKey: "VTAckAcknowledgements", defaultString: ""))

XCTAssertEqual("Generated by CocoaPods", MockAcknowListViewController.localizedString(forKey: "VTAckGeneratedByCocoaPods", defaultString: ""))
}

func testLocalizedStringReturnsFrench() {

class MockAcknowListViewController: AcknowListViewController {

override class func preferredLanguageCode() -> String {
return "fr-FR"
}
}

XCTAssertEqual("Remerciements", MockAcknowListViewController.localizedString(forKey: "VTAckAcknowledgements", defaultString: ""))

XCTAssertEqual("Généré par CocoaPods", MockAcknowListViewController.localizedString(forKey: "VTAckGeneratedByCocoaPods", defaultString: ""))
}

func testLocalizedStringReturnsSimplifiedChinese() {

class MockAcknowListViewController: AcknowListViewController {

override class func preferredLanguageCode() -> String {
return "zh-Hans"
}
}

XCTAssertEqual("致谢", MockAcknowListViewController.localizedString(forKey: "VTAckAcknowledgements", defaultString: ""))

XCTAssertEqual("使用 CocoaPods 生成", MockAcknowListViewController.localizedString(forKey: "VTAckGeneratedByCocoaPods", defaultString: ""))
}

}
43 changes: 0 additions & 43 deletions Tests/AcknowExampleTests/AcknowViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,47 +21,4 @@ class AcknowViewControllerTests: XCTestCase {
XCTAssertEqual(viewController.title, "Title")
XCTAssertEqual(viewController.textView!.text, "Text...")
}

func testLocalizedStringReturnsEnglish() {

class MockAcknowListViewController: AcknowListViewController {

override class func preferredLanguageCode() -> String {
return "en-GB"
}
}

XCTAssertEqual("Acknowledgements", MockAcknowListViewController.localizedString(forKey: "VTAckAcknowledgements", defaultString: ""))

XCTAssertEqual("Generated by CocoaPods", MockAcknowListViewController.localizedString(forKey: "VTAckGeneratedByCocoaPods", defaultString: ""))
}

func testLocalizedStringReturnsFrench() {

class MockAcknowListViewController: AcknowListViewController {

override class func preferredLanguageCode() -> String {
return "fr-FR"
}
}

XCTAssertEqual("Remerciements", MockAcknowListViewController.localizedString(forKey: "VTAckAcknowledgements", defaultString: ""))

XCTAssertEqual("Généré par CocoaPods", MockAcknowListViewController.localizedString(forKey: "VTAckGeneratedByCocoaPods", defaultString: ""))
}

func testLocalizedStringReturnsSimplifiedChinese() {

class MockAcknowListViewController: AcknowListViewController {

override class func preferredLanguageCode() -> String {
return "zh-Hans"
}
}

XCTAssertEqual("致谢", MockAcknowListViewController.localizedString(forKey: "VTAckAcknowledgements", defaultString: ""))

XCTAssertEqual("使用 CocoaPods 生成", MockAcknowListViewController.localizedString(forKey: "VTAckGeneratedByCocoaPods", defaultString: ""))
}

}

0 comments on commit 733f96f

Please sign in to comment.