Commit 2c6caf2 1 parent 0224025 commit 2c6caf2 Copy full SHA for 2c6caf2
File tree 1 file changed +25
-7
lines changed
Tests/NodesGeneratorTests/Support
1 file changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,16 @@ extension Array where Element == String {
14
14
internal static func mock( with identifier: String , count: Int ) -> Self {
15
15
guard count > 0
16
16
else { return [ ] }
17
- guard count > 1
18
- else { return [ " < \( identifier) > " ] }
19
- return ( 1 ... count) . map { " < \( identifier) \( $0) > " }
17
+ return switch count {
18
+ case 1 :
19
+ [
20
+ " < \( identifier) > "
21
+ ]
22
+ default :
23
+ ( 1 ... count) . map { index in
24
+ " < \( identifier) \( index) > "
25
+ }
26
+ }
20
27
}
21
28
}
22
29
@@ -25,10 +32,21 @@ extension Array where Element == Config.Variable {
25
32
internal static func mock( with identifier: String , count: Int ) -> Self {
26
33
guard count > 0
27
34
else { return [ ] }
28
- guard count > 1
29
- else { return [ Config . Variable ( name: " < \( identifier) Name> " , type: " < \( identifier) Type> " ) ] }
30
- return ( 1 ... count) . map { count in
31
- Config . Variable ( name: " < \( identifier) Name \( count) > " , type: " < \( identifier) Type \( count) > " )
35
+ return switch count {
36
+ case 1 :
37
+ [
38
+ Config . Variable (
39
+ name: " < \( identifier) Name> " ,
40
+ type: " < \( identifier) Type> "
41
+ )
42
+ ]
43
+ default :
44
+ ( 1 ... count) . map { index in
45
+ Config . Variable (
46
+ name: " < \( identifier) Name \( index) > " ,
47
+ type: " < \( identifier) Type \( index) > "
48
+ )
49
+ }
32
50
}
33
51
}
34
52
}
You can’t perform that action at this time.
0 commit comments