SwiftDocOrg / CommonMark

Create, parse, and render Markdown text according to the CommonMark specification
MIT License
179 stars 10 forks source link

Unify tests #23

Closed regexident closed 3 years ago

regexident commented 3 years ago

Order of arguments

Some of the unit tests had the order of asserted arguments mixed up:

XCTAssertEqual(expected, actual)

instead of

XCTAssertEqual(actual, expected)

Even though == is commutative the widely established standard order is assert(actual == expected) (or assert_eq(actual, expected)).

Local bindings

Others passed the value at test as an rvalue directly into the assert.

By introducing local bindings actual/expected where missing it becomes trivial to temporarily add a print(actual) or the like (since Xcode's assert popover is pretty much useless with its unformatted "wall of text" output).

It also improves the uniformity of the test suite, requiring less reading/parsing/thinking to understand the individual tests.

mattt commented 3 years ago

This is a nice change. Thanks for taking the time to do this, @regexident.