I'm facing unexpected behavior with after_each when there are multiple contexts. It appears the after_each is running for the tests in the wrong context.
The following example demonstrates the issue.
#include "bdd-for-c.h"
spec("after-each") {
context("Context 1") {
after_each() {
check(0);
}
it("should fail") {
}
}
context("Context 2") {
it("should succeed") {
check(1);
}
}
}
Output:
after-each
Context 1
should fail (OK)
Context 2
should succeed (FAIL)
Check failed: 0
at ../test_after_each.c:6
2 tests run, 1 failed.
I expected the after_each() in Context 1 to fail the tests in Context 1. Instead, it fails the test in Context 2.
I'm facing unexpected behavior with after_each when there are multiple contexts. It appears the after_each is running for the tests in the wrong context.
The following example demonstrates the issue.
Output:
I expected the after_each() in Context 1 to fail the tests in Context 1. Instead, it fails the test in Context 2.