mirror of
https://github.com/zhigang1992/R.swift.git
synced 2026-04-29 12:45:30 +08:00
Add Tests
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
5D1AFAB11C858637003FE7AB /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5D1AFAAF1C858637003FE7AB /* Localizable.strings */; };
|
||||
5D9E41341C96918E002172D3 /* StringsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D9E41331C96918E002172D3 /* StringsTests.swift */; };
|
||||
C378DD7A1C68C2BF003598B8 /* SupplementaryElement.xib in Resources */ = {isa = PBXBuildFile; fileRef = C378DD791C68C2BF003598B8 /* SupplementaryElement.xib */; };
|
||||
D50175BE1B5FEFD000DB8314 /* Secondary.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D50175BC1B5FEFD000DB8314 /* Secondary.storyboard */; };
|
||||
D5159E9E1BBC33680013F52A /* Colors@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D5159E9D1BBC33680013F52A /* Colors@2x.jpg */; };
|
||||
@@ -75,6 +76,7 @@
|
||||
5D1AFAB01C858637003FE7AB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
5D1AFAB21C858647003FE7AB /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
5D1AFAB31C85864F003FE7AB /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
5D9E41331C96918E002172D3 /* StringsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringsTests.swift; sourceTree = "<group>"; };
|
||||
9BB33190FE04C23E506646C2 /* Pods-ResourceApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ResourceApp.release.xcconfig"; path = "../Pods/Target Support Files/Pods-ResourceApp/Pods-ResourceApp.release.xcconfig"; sourceTree = "<group>"; };
|
||||
AEC5C6D68E1E8337CC9568C1 /* Pods_ResourceApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ResourceApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C378DD791C68C2BF003598B8 /* SupplementaryElement.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SupplementaryElement.xib; sourceTree = "<group>"; };
|
||||
@@ -265,6 +267,7 @@
|
||||
D51F47221B8FAF9F0028BAFD /* NibTests.swift */,
|
||||
D55C6CD51B5D757300301B0D /* ResourceAppTests.swift */,
|
||||
D56DC76F1C42A5E700623437 /* StoryboardTests.swift */,
|
||||
5D9E41331C96918E002172D3 /* StringsTests.swift */,
|
||||
D5EB326E1B63AD6B005C7B47 /* ValidationTests.swift */,
|
||||
D55C6CD31B5D757300301B0D /* Supporting Files */,
|
||||
);
|
||||
@@ -521,6 +524,7 @@
|
||||
files = (
|
||||
D5E513C01B8E11810035ECAA /* FontsTests.swift in Sources */,
|
||||
D56DC7701C42A5E700623437 /* StoryboardTests.swift in Sources */,
|
||||
5D9E41341C96918E002172D3 /* StringsTests.swift in Sources */,
|
||||
D5EB326F1B63AD6B005C7B47 /* ImagesTests.swift in Sources */,
|
||||
D51F47231B8FAF9F0028BAFD /* NibTests.swift in Sources */,
|
||||
D55C6CD61B5D757300301B0D /* ResourceAppTests.swift in Sources */,
|
||||
|
||||
@@ -13,6 +13,12 @@ import XCTest
|
||||
class ResourceAppTests: XCTestCase {
|
||||
|
||||
let expectedWarnings = [
|
||||
"warning: [R.swift] Locale 'en.lproj' is missing translations for keys: ['project.missingKey.3', 'project.missingKey.5', 'project.missingKey.6']",
|
||||
"warning: [R.swift] Locale 'es.lproj' is missing translations for keys: ['project.missingKey.2', 'project.missingKey.6', 'project.missingKey.7']",
|
||||
"warning: [R.swift] Locale 'ja.lproj' is missing translations for keys: ['project.missingKey.7', 'project.missingKey.8']",
|
||||
"warning: [R.swift] Locale 'en.lproj' has multiple translations for keys: ['project.duplicateKey.1', 'project.duplicateKey.2']",
|
||||
"warning: [R.swift] Locale 'es.lproj' has multiple translations for keys: ['project.duplicateKey.1', 'project.duplicateKey.2']",
|
||||
"warning: [R.swift] Locale 'ja.lproj' has multiple translations for keys: ['project.duplicateKey.1', 'project.duplicateKey.2']",
|
||||
"warning: [R.swift] Skipping 2 images because symbol 'second' would be generated for all of these images: Second, second",
|
||||
"warning: [R.swift] Skipping 2 xibs because symbol 'duplicate' would be generated for all of these xibs: Duplicate, duplicate",
|
||||
"warning: [R.swift] Skipping 2 storyboards because symbol 'duplicate' would be generated for all of these storyboards: Duplicate, duplicate",
|
||||
@@ -40,10 +46,8 @@ class ResourceAppTests: XCTestCase {
|
||||
}
|
||||
|
||||
XCTAssertEqual(logLines.count, expectedWarnings.count, "There are more/less warnings then expected")
|
||||
|
||||
} catch {
|
||||
XCTFail("Failed to read rswift.log")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
34
ResourceApp/ResourceAppTests/StringsTests.swift
Normal file
34
ResourceApp/ResourceAppTests/StringsTests.swift
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// StringsTests.swift
|
||||
// ResourceApp
|
||||
//
|
||||
// Created by Nolan Warner on 26-08-15.
|
||||
// Copyright © 2015 Nolan Warner. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import XCTest
|
||||
@testable import ResourceApp
|
||||
|
||||
class StringsTests: XCTestCase {
|
||||
|
||||
func testNoNilStrings() {
|
||||
XCTAssertNotNil(R.string.projectAbnormalKey1)
|
||||
XCTAssertNotNil(R.string.projectAbnormalKey2)
|
||||
XCTAssertNotNil(R.string.projectDuplicateKey1)
|
||||
XCTAssertNotNil(R.string.projectDuplicateKey2)
|
||||
XCTAssertNotNil(R.string.projectHyphenKey1)
|
||||
XCTAssertNotNil(R.string.projectMissingKey1)
|
||||
XCTAssertNotNil(R.string.projectMissingKey2)
|
||||
XCTAssertNotNil(R.string.projectMissingKey3)
|
||||
XCTAssertNotNil(R.string.projectMissingKey4)
|
||||
XCTAssertNotNil(R.string.projectMissingKey5)
|
||||
XCTAssertNotNil(R.string.projectMissingKey6)
|
||||
XCTAssertNotNil(R.string.projectMissingKey7)
|
||||
XCTAssertNotNil(R.string.projectMissingKey8)
|
||||
XCTAssertNotNil(R.string.projectMissingKey9)
|
||||
XCTAssertNotNil(R.string.projectMixedKey_1)
|
||||
XCTAssertNotNil(R.string.projectOddSpacingKey1)
|
||||
XCTAssertNotNil(R.string.project_underscoreKey_1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user