@@ -50,10 +50,11 @@ final class MultipartFormDataBuilderTests: XCTestCase {
50
50
XCTAssertEqual ( subparts, expectedSubparts)
51
51
}
52
52
53
+ // swiftlint:disable function_body_length
54
+ // swiftlint:disable closure_body_length
53
55
func testAllBuildMethods( ) throws {
54
56
let subparts = try _buildSubparts {
55
-
56
- // buildArray
57
+ // buildArray(_:)
57
58
for index in 0 ... 2 {
58
59
try Subpart {
59
60
try ContentDisposition ( uncheckedName: index. description)
@@ -62,27 +63,49 @@ final class MultipartFormDataBuilderTests: XCTestCase {
62
63
}
63
64
}
64
65
65
- // buildOptional
66
- if true {
66
+ // buildOptional(_:)
67
+ if Bool ( truncating : 1 ) {
67
68
Subpart {
68
69
ContentDisposition ( name: " true " )
69
70
} body: {
70
71
Data ( " true " . utf8)
71
72
}
72
73
}
74
+ if Bool ( truncating: 0 ) {
75
+ Subpart {
76
+ ContentDisposition ( name: " false " )
77
+ } body: {
78
+ Data ( " false " . utf8)
79
+ }
80
+ }
81
+
82
+ // buildEither(first:)
83
+ if Bool ( truncating: 1 ) {
84
+ Subpart {
85
+ ContentDisposition ( name: " first " )
86
+ } body: {
87
+ Data ( " first " . utf8)
88
+ }
89
+ } else {
90
+ Subpart {
91
+ ContentDisposition ( name: " second " )
92
+ } body: {
93
+ Data ( " second " . utf8)
94
+ }
95
+ }
73
96
74
- // buildEither
75
- if . random ( ) {
97
+ // buildEither(second:)
98
+ if Bool ( truncating : 0 ) {
76
99
Subpart {
77
- ContentDisposition ( name: " random " )
100
+ ContentDisposition ( name: " first " )
78
101
} body: {
79
- Data ( " random " . utf8)
102
+ Data ( " first " . utf8)
80
103
}
81
104
} else {
82
105
Subpart {
83
- ContentDisposition ( name: " random " )
106
+ ContentDisposition ( name: " second " )
84
107
} body: {
85
- Data ( " random " . utf8)
108
+ Data ( " second " . utf8)
86
109
}
87
110
}
88
111
}
@@ -91,10 +114,13 @@ final class MultipartFormDataBuilderTests: XCTestCase {
91
114
Subpart ( contentDisposition: ContentDisposition ( name: " 1 " ) , body: Data ( " 1 " . utf8) ) ,
92
115
Subpart ( contentDisposition: ContentDisposition ( name: " 2 " ) , body: Data ( " 2 " . utf8) ) ,
93
116
Subpart ( contentDisposition: ContentDisposition ( name: " true " ) , body: Data ( " true " . utf8) ) ,
94
- Subpart ( contentDisposition: ContentDisposition ( name: " random " ) , body: Data ( " random " . utf8) ) ,
117
+ Subpart ( contentDisposition: ContentDisposition ( name: " first " ) , body: Data ( " first " . utf8) ) ,
118
+ Subpart ( contentDisposition: ContentDisposition ( name: " second " ) , body: Data ( " second " . utf8) ) ,
95
119
]
96
120
XCTAssertEqual ( subparts, expectedSubparts)
97
121
}
122
+ // swiftlint:enable function_body_length
123
+ // swiftlint:enable closure_body_length
98
124
}
99
125
100
126
extension MultipartFormDataBuilderTests {
0 commit comments