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
+43-12Lines changed: 43 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -211,24 +211,55 @@ end;
211
211
```
212
212
The `a_nulls_are_equal` parameter controls the behavior of a `null=null` comparison (**this comparison by default is true!**)
213
213
214
-
### Comparing cursors
214
+
### Excluding columns and attributes from comparison
215
215
216
-
The `equal` matcher accepts an additional parameter `a_exclude varchar2` or `a_exclude ut_varchar2_list`, when used to compare `cursor` data.
216
+
The `equal` matcher accepts an additional parameter `a_exclude`when used to compare data of `cursor`, `object` or `table type`.
217
217
218
-
These parameters enable a list of column names to be passed for exclusion from the data comparison. The list can be a comma separated `varchar2` list or a `ut_varchar2_list` collection.
219
-
The column names accepted by the parameter are **case sensitive** and cannot be quoted.
220
-
If the `a_exclude` parameter is not specified, all columns are included.
221
-
If a column to be excluded does not exist, the column cannot be excluded and it's name is simply ignored.
222
-
This is useful when testing cursors containing data that is beyond our control (like default or trigger/procedure generated sysdate values on columns).
218
+
This parameter can take three forms:
219
+
1. A `varchar2` containing comma separated names of columns/attributes to exclude
220
+
2. A `varchar2` containing **XPath** expression that lists items to be excluded
221
+
3. A `ut_varchar2_list` containing list of columns/attributes to exclude
222
+
223
+
The column/attribute names are **case sensitive** and cannot be quoted.
224
+
If the `a_exclude` parameter is not specified, whole cursor/object/table type is compared.
225
+
If a column/attribute to be excluded does not exist it is simply ignored (no error).
226
+
227
+
This is useful when testing elements data that cannot be determined or set up by the tests (like `sysdate` populated by default on audit columns).
223
228
224
229
```sql
225
230
procedure test_cursors_skip_columns is
226
-
x sys_refcursor;
227
-
y sys_refcursor;
231
+
l_expected sys_refcursor;
232
+
l_actual sys_refcursor;
228
233
begin
229
-
open x for select'text' ignore_me, d.*from user_tables d;
230
-
open y for selectsysdate"ADate", d.*from user_tables d;
0 commit comments