Skip to content
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

Add ability to capture variables from test scope #48

Closed
iSLC opened this issue Jan 24, 2017 · 1 comment
Closed

Add ability to capture variables from test scope #48

iSLC opened this issue Jan 24, 2017 · 1 comment

Comments

@iSLC
Copy link

iSLC commented Jan 24, 2017

I'm in the position where I have to generate random combinations of a fixed length string and then run a parser function on them and compare the result of the function with a known value. However, if the assertion fails, I don't know what was in the string that failed to be parsed.

I remember that in Catch there was a macro called CAPTURE or something like that. Which allowed me to see the contents of that variable in case an assertion macro failed in that scope.

Is there something similar in doctest or a way to implement it? I can't seem to find anything related in the reference or tutorials.

@onqtam onqtam changed the title Capture variables from test scope Add ability to capture variables from test scope Mar 22, 2017
onqtam added a commit that referenced this issue Mar 26, 2017
…d construct a message which gets printed only when an assert in the same scope (or in a nested one) after them fails. They use lazy stringification and the stack to avoid heap allocations and unnecessary string construction for the common case where no asserts fail. fixes #48 fixes #23
@onqtam
Copy link
Member

onqtam commented Mar 26, 2017

This is implemented in the dev branch - check out the documentation

onqtam added a commit that referenced this issue Mar 26, 2017
…:ostream - trying to fix builds for VS 2008/2010/2012/2013 - oddly enough 2015/2017 pass (also all gcc/clang versions under linux/osx pass as well...) - relates #23 relates #48
onqtam added a commit that referenced this issue Mar 28, 2017
onqtam added a commit that referenced this issue Mar 28, 2017
…mporaries even in C++98 (but compilation error messages will be horrible) - relates #23 relates #48
onqtam added a commit that referenced this issue Mar 28, 2017
onqtam added a commit that referenced this issue Mar 28, 2017
…- relates #23 relates #48

Basically these are just a paired INFO() with an ASSERT() inside of a code block - { INFO(msg); CHECK(expr); }
onqtam added a commit that referenced this issue Apr 9, 2017
onqtam added a commit that referenced this issue Apr 10, 2017
… from an exception - relates #48 #23 (also see this Catch PR: catchorg/Catch2#876 )
@onqtam onqtam closed this as completed in a369a98 May 15, 2017
onqtam added a commit that referenced this issue May 15, 2017
…:ostream - trying to fix builds for VS 2008/2010/2012/2013 - oddly enough 2015/2017 pass (also all gcc/clang versions under linux/osx pass as well...) - relates #23 relates #48
onqtam added a commit that referenced this issue May 15, 2017
onqtam added a commit that referenced this issue May 15, 2017
…mporaries even in C++98 (but compilation error messages will be horrible) - relates #23 relates #48
onqtam added a commit that referenced this issue May 15, 2017
onqtam added a commit that referenced this issue May 15, 2017
…- relates #23 relates #48

Basically these are just a paired INFO() with an ASSERT() inside of a code block - { INFO(msg); CHECK(expr); }
onqtam added a commit that referenced this issue May 15, 2017
onqtam added a commit that referenced this issue May 15, 2017
… from an exception - relates #48 #23 (also see this Catch PR: catchorg/Catch2#876 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants