-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Internal Code, Shell, Testing Infrastructure
-
Query Execution
-
Fully Compatible
-
QE 2022-09-19, QE 2022-10-03, QE 2022-10-17, QE 2022-10-31, QE 2022-11-14, QE 2022-11-28, QE 2022-12-12, QE 2022-12-26, QE 2023-01-09, QE 2023-01-23
Create a new assert.eq() operator that assigns meanings to its operands – for example, explicitly making one argument expected and the other argument actual. This would allow for us to make better, more readable error messages when the assertions actually fail.
One way to migrate the code from the old assert.eq() to the new one:
- Rename the existing function assert.eq_deprecated(), and replace all existing usages via sed.
- Create a new assert.eq() with the desired semantics and start using it in new code.
- Create tickets to migrate older code to use the newer version
Original Description
Currently, the signature is just function (a, b, msg) and the message in case of failure is just "[1] != [0] are not equal" and you have to look into the test to understand if 1 is expected or if 0 is expected.
I suggest to change the signature to function(expected, actual, msg) and change the default message to "expected value [1] and actual value [0] are not equal". Of course, many tests still use those interchangeably, but we can write the new tests following this semantics and "fix" the existing tests over time.