You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Tests/LocheckLogicTests/ValidateStringsTests.swift
+21-8
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,13 @@ class ValidateStringsTests: XCTestCase {
41
41
letproblemReporter=ProblemReporter(log:false)
42
42
validateStrings(
43
43
baseStrings:[
44
+
// Don't report errors on just one arg
45
+
LocalizedStringPair(
46
+
string:"\"%d\" = \"%d\";",
47
+
path:"abc",
48
+
line:0,
49
+
basePath:"",
50
+
baseLineFallback:0)!,
44
51
LocalizedStringPair(
45
52
string:"\"present %d %@\" = \"present %d %@\";",
46
53
path:"abc",
@@ -49,6 +56,12 @@ class ValidateStringsTests: XCTestCase {
49
56
baseLineFallback:0)!,
50
57
],
51
58
translationStrings:[
59
+
LocalizedStringPair(
60
+
string:"\"%d\" = \"%d\";",
61
+
path:"abc",
62
+
line:0,
63
+
basePath:"",
64
+
baseLineFallback:0)!,
52
65
LocalizedStringPair(
53
66
string:"\"present %d %@\" = \"%d %@\";",
54
67
path:"def",
@@ -64,10 +77,10 @@ class ValidateStringsTests: XCTestCase {
64
77
XCTAssertEqual(
65
78
problemReporter.problems.map(\.messageForXcode),
66
79
[
67
-
":0: warning: Argument 1 in \'present %d %@\' has an implicit position. Use an explicit position for safety (%$1d). (string_has_implicit_position)",
68
-
":0: warning: Argument 2 in \'present %d %@\' has an implicit position. Use an explicit position for safety (%$2@). (string_has_implicit_position)",
69
-
"def:0: warning: Argument 1 in translation of \'present %d %@\' (\'%d %@\') has an implicit position. Use an explicit position for safety (%$1d). (string_has_implicit_position)",
70
-
"def:0: warning: Argument 2 in translation of \'present %d %@\' (\'%d %@\') has an implicit position. Use an explicit position for safety (%$2@). (string_has_implicit_position)",
80
+
":0: warning: Argument 1 in \'present %d %@\' has an implicit position. Use an explicit position for safety (%1$d). (string_has_implicit_position)",
81
+
":0: warning: Argument 2 in \'present %d %@\' has an implicit position. Use an explicit position for safety (%2$@). (string_has_implicit_position)",
82
+
"def:0: warning: Argument 1 in translation of \'present %d %@\' (\'%d %@\') has an implicit position. Use an explicit position for safety (%1$d). (string_has_implicit_position)",
83
+
"def:0: warning: Argument 2 in translation of \'present %d %@\' (\'%d %@\') has an implicit position. Use an explicit position for safety (%2$@). (string_has_implicit_position)",
71
84
])
72
85
}
73
86
@@ -98,11 +111,11 @@ class ValidateStringsTests: XCTestCase {
98
111
XCTAssertEqual(
99
112
problemReporter.problems.map(\.messageForXcode),
100
113
[
101
-
":0: warning: Argument 1 in \'present %d %@\' has an implicit position. Use an explicit position for safety (%$1d). (string_has_implicit_position)",
102
-
":0: warning: Argument 2 in \'present %d %@\' has an implicit position. Use an explicit position for safety (%$2@). (string_has_implicit_position)",
103
-
"def:0: warning: Argument 1 in translation of \'present %d %@\' (\'%@ %d tneserp\') has an implicit position. Use an explicit position for safety (%$1@). (string_has_implicit_position)",
114
+
":0: warning: Argument 1 in \'present %d %@\' has an implicit position. Use an explicit position for safety (%1$d). (string_has_implicit_position)",
115
+
":0: warning: Argument 2 in \'present %d %@\' has an implicit position. Use an explicit position for safety (%2$@). (string_has_implicit_position)",
116
+
"def:0: warning: Argument 1 in translation of \'present %d %@\' (\'%@ %d tneserp\') has an implicit position. Use an explicit position for safety (%1$@). (string_has_implicit_position)",
104
117
"def:0: error: Specifier for argument 1 does not match (should be d, is @) (string_has_invalid_argument)",
105
-
"def:0: warning: Argument 2 in translation of \'present %d %@\' (\'%@ %d tneserp\') has an implicit position. Use an explicit position for safety (%$2d). (string_has_implicit_position)",
118
+
"def:0: warning: Argument 2 in translation of \'present %d %@\' (\'%@ %d tneserp\') has an implicit position. Use an explicit position for safety (%2$d). (string_has_implicit_position)",
106
119
"def:0: error: Specifier for argument 2 does not match (should be @, is d) (string_has_invalid_argument)",
Copy file name to clipboardExpand all lines: Tests/LocheckLogicTests/parseAndValidateStringsdictTests.swift
+10-10
Original file line number
Diff line number
Diff line change
@@ -34,20 +34,20 @@ class ParseAndValidateStringsdictTests: XCTestCase {
34
34
Examples/Demo_Base.stringsdict:81: warning: '%s added %d task(s) to 's'' is missing from Demo_Translation (key_missing_from_translation)
35
35
Examples/Demo_Base.stringsdict:63: warning: 'missing from translation' is missing from Demo_Translation (key_missing_from_translation)
36
36
Examples/Demo_Translation.stringsdict:22: warning: 'missing from base' is missing from the base translation (key_missing_from_base)
37
-
Examples/Demo_Base.stringsdict:6: warning: Argument 1 in permutation 'Every %d weeks on %2$lu days' of 'Every %d week(s) on %lu days' has an implicit position. Use an explicit position for safety (%$1d). (stringsdict_entry_has_implicit_position)
38
-
Examples/Demo_Base.stringsdict:81: warning: Argument 1 in permutation '%s added %d tasks and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%$1s). (stringsdict_entry_has_implicit_position)
39
-
Examples/Demo_Base.stringsdict:81: warning: Argument 2 in permutation '%s added %d tasks and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%$2d). (stringsdict_entry_has_implicit_position)
40
-
Examples/Demo_Base.stringsdict:81: warning: Argument 3 in permutation '%s added %d tasks and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%$3d). (stringsdict_entry_has_implicit_position)
37
+
Examples/Demo_Base.stringsdict:6: warning: Argument 1 in permutation 'Every %d weeks on %2$lu days' of 'Every %d week(s) on %lu days' has an implicit position. Use an explicit position for safety (%1$d). (stringsdict_entry_has_implicit_position)
38
+
Examples/Demo_Base.stringsdict:81: warning: Argument 1 in permutation '%s added %d tasks and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%1$s). (stringsdict_entry_has_implicit_position)
39
+
Examples/Demo_Base.stringsdict:81: warning: Argument 2 in permutation '%s added %d tasks and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%2$d). (stringsdict_entry_has_implicit_position)
40
+
Examples/Demo_Base.stringsdict:81: warning: Argument 3 in permutation '%s added %d tasks and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%3$d). (stringsdict_entry_has_implicit_position)
41
41
Examples/Demo_Base.stringsdict:81: error: Two permutations of '%s added %d task(s) to 's'' contain different format specifiers at position 3. '%s added %d tasks and %d milestones to %3$s' uses 'd', and '%s added %d tasks and %d milestones to %3$s' uses 's'. (stringsdict_entry_permutations_have_conflicting_specifiers)
42
-
Examples/Demo_Base.stringsdict:81: warning: Argument 1 in permutation '%s added %d tasks and a milestone to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%$1s). (stringsdict_entry_has_implicit_position)
43
-
Examples/Demo_Base.stringsdict:81: warning: Argument 2 in permutation '%s added %d tasks and a milestone to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%$2d). (stringsdict_entry_has_implicit_position)
42
+
Examples/Demo_Base.stringsdict:81: warning: Argument 1 in permutation '%s added %d tasks and a milestone to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%1$s). (stringsdict_entry_has_implicit_position)
43
+
Examples/Demo_Base.stringsdict:81: warning: Argument 2 in permutation '%s added %d tasks and a milestone to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%2$d). (stringsdict_entry_has_implicit_position)
44
44
Examples/Demo_Base.stringsdict:81: error: Two permutations of '%s added %d task(s) to 's'' contain different format specifiers at position 3. '%s added %d tasks and %d milestones to %3$s' uses 'd', and '%s added %d tasks and a milestone to %3$s' uses 's'. (stringsdict_entry_permutations_have_conflicting_specifiers)
45
-
Examples/Demo_Base.stringsdict:81: warning: Argument 1 in permutation '%s added a task and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%$1s). (stringsdict_entry_has_implicit_position)
46
-
Examples/Demo_Base.stringsdict:81: warning: Argument 2 in permutation '%s added a task and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%$2d). (stringsdict_entry_has_implicit_position)
45
+
Examples/Demo_Base.stringsdict:81: warning: Argument 1 in permutation '%s added a task and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%1$s). (stringsdict_entry_has_implicit_position)
46
+
Examples/Demo_Base.stringsdict:81: warning: Argument 2 in permutation '%s added a task and %d milestones to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%2$d). (stringsdict_entry_has_implicit_position)
47
47
Examples/Demo_Base.stringsdict:81: error: Two permutations of '%s added %d task(s) to 's'' contain different format specifiers at position 3. '%s added %d tasks and %d milestones to %3$s' uses 'd', and '%s added a task and %d milestones to %3$s' uses 's'. (stringsdict_entry_permutations_have_conflicting_specifiers)
48
-
Examples/Demo_Base.stringsdict:81: warning: Argument 1 in permutation '%s added a task and a milestone to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%$1s). (stringsdict_entry_has_implicit_position)
48
+
Examples/Demo_Base.stringsdict:81: warning: Argument 1 in permutation '%s added a task and a milestone to %3$s' of '%s added %d task(s) to 's'' has an implicit position. Use an explicit position for safety (%1$s). (stringsdict_entry_has_implicit_position)
49
49
Examples/Demo_Base.stringsdict:81: error: Two permutations of '%s added %d task(s) to 's'' contain different format specifiers at position 3. '%s added %d tasks and %d milestones to %3$s' uses 'd', and '%s added a task and a milestone to %3$s' uses 's'. (stringsdict_entry_permutations_have_conflicting_specifiers)
50
-
Examples/Demo_Translation.stringsdict:6: warning: Argument 1 in permutation '%2$lu jours toutes les %d semaines' of 'Every %d week(s) on %lu days' has an implicit position. Use an explicit position for safety (%$1d). (stringsdict_entry_has_implicit_position)
50
+
Examples/Demo_Translation.stringsdict:6: warning: Argument 1 in permutation '%2$lu jours toutes les %d semaines' of 'Every %d week(s) on %lu days' has an implicit position. Use an explicit position for safety (%1$d). (stringsdict_entry_has_implicit_position)
0 commit comments