@@ -121,6 +121,71 @@ class DifferSpec extends ScalaCheckSuite {
121
121
)
122
122
}
123
123
124
+ test(" Option: fail if one is Some and one is None" ) {
125
+ assertConsoleDiffOutput(
126
+ Differ [Option [CC ]],
127
+ Some (CC (2 , " 2" , 3.0 )),
128
+ None ,
129
+ s """ ${R }Some $X != ${G }None $X
130
+ | ${R }=== Obtained ===
131
+ |Some(
132
+ | value: CC(
133
+ | i: 2,
134
+ | s: "2",
135
+ | dd: 3.0,
136
+ | ),
137
+ |) $X
138
+ | ${G }=== Expected ===
139
+ |None(
140
+ |) $X""" .stripMargin,
141
+ )
142
+ }
143
+
144
+ test(" Option: isOk == true if two values are equal" ) {
145
+ assertOkIfValuesEqualProp(Differ [Option [CC ]])
146
+ }
147
+
148
+ test(" Option: isOk == false if two values are NOT equal" ) {
149
+ assertNotOkIfNotEqualProp(Differ [Option [CC ]])
150
+ }
151
+
152
+ test(" Option: isOk always true if differ is marked ignored" ) {
153
+ assertIsOkIfIgnoredProp(Differ [Option [CC ]])
154
+ }
155
+
156
+ test(" Either: fail if one is Some and one is None" ) {
157
+ assertConsoleDiffOutput(
158
+ Differ [Either [String , CC ]],
159
+ Right (CC (2 , " 2" , 3.0 )),
160
+ Left (" nope" ),
161
+ s """ ${R }Right $X != ${G }Left $X
162
+ | ${R }=== Obtained ===
163
+ |Right(
164
+ | value: CC(
165
+ | i: 2,
166
+ | s: "2",
167
+ | dd: 3.0,
168
+ | ),
169
+ |) $X
170
+ | ${G }=== Expected ===
171
+ |Left(
172
+ | value: "nope",
173
+ |) $X""" .stripMargin,
174
+ )
175
+ }
176
+
177
+ test(" Either: isOk == true if two values are equal" ) {
178
+ assertOkIfValuesEqualProp(Differ [Either [String , CC ]])
179
+ }
180
+
181
+ test(" Either: isOk == false if two values are NOT equal" ) {
182
+ assertNotOkIfNotEqualProp(Differ [Either [String , CC ]])
183
+ }
184
+
185
+ test(" Either: isOk always true if differ is marked ignored" ) {
186
+ assertIsOkIfIgnoredProp(Differ [Either [String , CC ]])
187
+ }
188
+
124
189
test(" Map: isOk == true if two values are equal" ) {
125
190
assertOkIfValuesEqualProp(Differ .mapDiffer[Map , MapKey , CC ])
126
191
}
0 commit comments