Replies: 1 comment 4 replies
-
First thing you can do is collect the different results, and return them as an array or Dict: begin
test = WasRun("some_name") #this is a simple struct which holds a bool wasRun
pre_result = @test test.wasRun == false
run(test) # this toggles the variable from false to true to simulate 'running'
post_result = @test test.wasRun == true
[pre_result, post_result]
end or
What is this @test behavior? You have an example? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This feature is very useful for TDD with the simplest applications. One example I'm trying is this cell
The problem is that the output of the whole cell (and its pass state) is defined by the last state. If I define
test.wasRun
astrue
by default, the cell will still give me a green ball, even though it should be red because of the second line.There are numerous applications for this 'before-and-after' behavior.
One alternative I can think of right now is to create a function which returns a boolean of the resulting steps, but this would either mean running all steps to reach a conclusion or write a bit more code to get the same
@test
behavior as regular Julia Tests does (return false when the first assertion fails, pointing to the state of the failure)Beta Was this translation helpful? Give feedback.
All reactions