New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUnit: the error message is shorten, when asserting equality of 2 lists with multi-line strings #2680

Closed
sejvlond opened this Issue Mar 6, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@sejvlond
Contributor

sejvlond commented Mar 6, 2018

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?

davidnich added a commit that referenced this issue Mar 10, 2018

refs #2680 improved QUnit output in assertion failures for strings wi…
…th special whitespace and for multi-line data structures

sejvlond added a commit that referenced this issue Mar 12, 2018

Merge pull request #2693 from qorelanguage/bugfix/2680_QUnit_output_fix
refs #2680 improved QUnit output in assertion failures for strings wi…

@davidnich davidnich added the fixed label Mar 12, 2018

@davidnich davidnich closed this Mar 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment