redding / assert

Assertion style testing framework.
https://github.com/redding/assert
MIT License
10 stars 1 forks source link

track the file and line number for each test #211

Closed kellyredding closed 9 years ago

kellyredding commented 9 years ago

Using the context info's called from attribute, we can pull out and track which file and line number a test is defined on. This will allow running tests by file/line-number and is prep for that feature.

Note: this also updates the methods macro to properly pass called from context to its test definition. The single methods test will be seen a defined on the line of the first methods macro in the test file. I noticed this was incorrect while debugging for the file line number change.

Note also: this updates assert's own factory to extend assert factory. This opens up all the factory methods for use in assert's own test suite. Note really sure why this wasn't done already - it was probably just missed. I switched to using factory methods to build the context info called from factory.

Related to #120.

@jcredding ready for review.

jcredding commented 9 years ago

@kellyredding - One minor comment, otherwise everything makes sense to me :boom: Nice catches on using asserts factory and cleaning up the called from for the has methods tests.

kellyredding commented 9 years ago

@jcredding thanks! I've updated that reject and found another one that could benefit from the same update.

Yeah, I stumbled across this change randomly while looking at parallel test stuff. I was assuming we'd have to wait for the run by line number feature. But with this little nugget, I can go ahead and implement it now. So cool.

kellyredding commented 9 years ago

(notes)

We discussed modeling a "FileLine" or something to encapsulate the file/line-number combo and encapsulate equality checking against both. This may be useful to track on the test and then use when doing #120.