When asserting equality of 2 lists with multi-line strings the error message is a bit confusing. Consider code below:
%new-style
%requires QUnit
%exec-class Test
class Test inherits QUnit::Test {
constructor() : QUnit::Test("Test", "1.0") {
addTestCase("test foo", \test_foo());
set_return_value(main());
}
test_foo() {
list l1 = ("hello\nworld",);
list l2 = ("hello\nmars",);
assertEq(l1, l2);
}
}
And the output:
Assertion failure at a.q:17 [Test::test_foo()]
-----
>> Expected:
>> --------------------
>> list: (1 element)
>> [0]="hello
>> world"
>> --------------------
>> Actual:
>> --------------------
>> list: (1 element)
>> [0]="hello
>> mars"
>> --------------------
>> Details:
>> --------------------
>> The values of [0] differ:
>> expected: "hello (string)
>> actual: "hello (string)
>> --------------------
-----
Ran 1 test case, 1 error (1 assertion, 0 succeeded)
The details are confusing, because there is only the first line of the string. It's probably intended, because I can see that there is a shorten function: https://github.com/qorelanguage/qore/blob/develop/qlib/QUnit.qm#L1082
But is it really necessary to shorten the message?
When asserting equality of 2 lists with multi-line strings the error message is a bit confusing. Consider code below:
And the output:
The details are confusing, because there is only the first line of the string. It's probably intended, because I can see that there is a
shortenfunction: https://github.com/qorelanguage/qore/blob/develop/qlib/QUnit.qm#L1082But is it really necessary to shorten the message?