@@ -55,8 +55,22 @@ final class LocalizationTests: XCTestCase {
5555 " base " = " Seconds Duplicate " ;
5656 """
5757 englishLocalization = setupFile ( with: content, for: englishLocalizationFilePath)
58- let violations = validators. validateDuplicateKeys ( in: [ englishLocalization] )
59- XCTAssert ( violations. filter ( { $0. rule is DuplicateRule } ) . count == 4 , " No Duplicates found " )
58+ let violations = DuplicateKeyRule ( ) . validation ( projectFiles: [ ] , localizationFiles: [ englishLocalization] )
59+ XCTAssert ( violations. filter ( { $0. rule is DuplicateKeyRule } ) . count == 4 , " No Duplicates keys found " )
60+ }
61+
62+ func testSameValueDifferentKeysViolation( ) {
63+ let content : String =
64+ """
65+ " candle " = " Candle " ;
66+ " about " = " Yes " ;
67+ " title " = " Yes " ;
68+ " base " = " No " ;
69+ " base " = " Seconds Duplicate " ;
70+ """
71+ englishLocalization = setupFile ( with: content, for: englishLocalizationFilePath)
72+ let violations = DuplicateValueRule ( ) . validation ( projectFiles: [ ] , localizationFiles: [ englishLocalization] )
73+ XCTAssert ( violations. filter ( { $0. rule is DuplicateValueRule } ) . count == 2 , " No Duplicates values found " )
6074 }
6175
6276 func testAllLocalizationFilesKeysMatch( ) {
@@ -68,7 +82,7 @@ final class LocalizationTests: XCTestCase {
6882 """
6983 englishLocalization = setupFile ( with: content, for: englishLocalizationFilePath)
7084 spanishLocalization = setupFile ( with: content, for: spanishLocalizationFilePath)
71- let violations = validators . validateLocalizationKeysMatch ( in : [ englishLocalization, spanishLocalization] )
85+ let violations = MatchRule ( ) . validation ( projectFiles : [ ] , localizationFiles : [ englishLocalization, spanishLocalization] )
7286 XCTAssert ( violations. filter ( { $0. rule is MatchRule } ) . isEmpty, " Localization files dont match " )
7387 }
7488
@@ -87,7 +101,7 @@ final class LocalizationTests: XCTestCase {
87101 """
88102 englishLocalization = setupFile ( with: englishContent, for: englishLocalizationFilePath)
89103 spanishLocalization = setupFile ( with: spanishContent, for: spanishLocalizationFilePath)
90- let violations = validators . validateLocalizationKeysMatch ( in : [ englishLocalization, spanishLocalization] )
104+ let violations = MatchRule ( ) . validation ( projectFiles : [ ] , localizationFiles : [ englishLocalization, spanishLocalization] )
91105 XCTAssert ( !violations. filter ( { $0. rule is MatchRule } ) . isEmpty, " Localization files dont match " )
92106 }
93107
0 commit comments