2023-11-10 20:47:11 +00:00
|
|
|
befores_called := 0;
|
|
|
|
afters_called := 0;
|
|
|
|
|
|
|
|
main :: () {
|
|
|
|
Init_Test_Harness();
|
|
|
|
|
2023-11-10 21:38:45 +00:00
|
|
|
// You can declare a single Before_Each function
|
|
|
|
// that will run before each test in this suite
|
2023-11-10 20:47:11 +00:00
|
|
|
Before_Each(() {
|
|
|
|
befores_called += 1;
|
|
|
|
});
|
|
|
|
|
2023-11-10 21:38:45 +00:00
|
|
|
// Similarly, you can run an After_Each function as well
|
2023-11-10 20:47:11 +00:00
|
|
|
After_Each(() {
|
|
|
|
afters_called += 1;
|
|
|
|
});
|
|
|
|
|
|
|
|
Test("before / after hooks #1", () {
|
|
|
|
expect(befores_called, 1);
|
|
|
|
expect(afters_called, 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
Test("before / after hooks #2", () {
|
|
|
|
expect(befores_called, 2);
|
|
|
|
expect(afters_called, 1);
|
|
|
|
});
|
|
|
|
|
|
|
|
Run_Test_Harness();
|
|
|
|
}
|