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: docs/userguide/expectations.md
+34-1Lines changed: 34 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -443,9 +443,42 @@ The matcher supports all advanced comparison options as `equal` e.g. include , e
443
443
444
444
The matcher will be successful only when all of the values in expected results are part of actual set.
445
445
446
+
In situation where the duplicate is present in expected set we would also expect matching number of occurrences in actual set for matcher to be success.
447
+
448
+
*Example 1*
449
+
450
+
```sql
451
+
PROCEDURE ut_refcursors IS
452
+
l_actual SYS_REFCURSOR;
453
+
l_expected SYS_REFCURSOR;
454
+
begin
455
+
--Arrange
456
+
open l_actual for select rownum as rn from dual a connect by level <10;
457
+
open l_expected for select rownum as rn from dual a connect by level <4
458
+
union allselect rownum as rn from dual a connect by level <4;
459
+
460
+
--Act
461
+
ut.expect(l_actual).to_include(l_expected);
462
+
END;
463
+
```
464
+
465
+
Will result in failure message
466
+
467
+
```sql
468
+
1) ut_refcursors
469
+
Actual: refcursor [ count =9 ] was expected to include: refcursor [ count =6 ]
470
+
Diff:
471
+
Rows: [ 3 differences ]
472
+
Missing: <ROW><RN>3</RN></ROW>
473
+
Missing: <ROW><RN>2</RN></ROW>
474
+
Missing: <ROW><RN>1</RN></ROW>
475
+
```
476
+
477
+
478
+
446
479
Similar negated `not_to_include`/ `not_to_contain` will be successful only when none of the values from expected set are part of actual e.g.
0 commit comments