3675
This commit is contained in:
parent
293732951a
commit
4cec4143d3
12
003trace.cc
12
003trace.cc
|
@ -183,9 +183,13 @@ int Trace_errors = 0; // used only when Trace_stream is NULL
|
|||
// Inside tests, fail any tests that displayed (unexpected) errors.
|
||||
// Expected errors in tests should always be hidden and silently checked for.
|
||||
:(before "End Test Teardown")
|
||||
if (Passed && !Hide_errors && trace_count("error") > 0) {
|
||||
if (Passed && !Hide_errors && trace_contains_errors()) {
|
||||
Passed = false;
|
||||
}
|
||||
:(code)
|
||||
bool trace_contains_errors() {
|
||||
return Trace_errors > 0 || trace_count("error") > 0;
|
||||
}
|
||||
|
||||
:(before "End Types")
|
||||
struct end {};
|
||||
|
@ -223,9 +227,9 @@ START_TRACING_UNTIL_END_OF_SCOPE
|
|||
:(before "End Includes")
|
||||
#define CHECK_TRACE_CONTENTS(...) check_trace_contents(__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
|
||||
|
||||
#define CHECK_TRACE_CONTAINS_ERROR() CHECK(trace_count("error") > 0)
|
||||
#define CHECK_TRACE_DOESNT_CONTAIN_ERROR() \
|
||||
if (Passed && trace_count("error") > 0) { \
|
||||
#define CHECK_TRACE_CONTAINS_ERRORS() CHECK(trace_contains_errors())
|
||||
#define CHECK_TRACE_DOESNT_CONTAIN_ERRORS() \
|
||||
if (Passed && trace_contains_errors()) { \
|
||||
cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): unexpected errors\n"; \
|
||||
DUMP("error"); \
|
||||
Passed = false; \
|
||||
|
|
|
@ -177,7 +177,7 @@ if (argc > 1) {
|
|||
transform_all();
|
||||
//? DUMP("");
|
||||
//? exit(0);
|
||||
if (Trace_errors) return 1;
|
||||
if (trace_contains_errors()) return 1;
|
||||
save_snapshots();
|
||||
|
||||
//: Step 3: if we aren't running tests, locate a recipe called 'main' and
|
||||
|
@ -374,7 +374,7 @@ void run(const string& form) {
|
|||
vector<recipe_ordinal> tmp = load(form);
|
||||
transform_all();
|
||||
if (tmp.empty()) return;
|
||||
if (trace_count("error") > 0) return;
|
||||
if (trace_contains_errors()) return;
|
||||
// if a test defines main, it probably wants to start there regardless of
|
||||
// definition order
|
||||
if (contains_key(Recipe, get(Recipe_ordinal, "main")))
|
||||
|
|
|
@ -779,12 +779,12 @@ void test_error_on_transform_all_between_container_definition_and_extension() {
|
|||
"]\n");
|
||||
// try to extend the container after transform
|
||||
transform_all();
|
||||
CHECK_TRACE_DOESNT_CONTAIN_ERROR();
|
||||
CHECK_TRACE_DOESNT_CONTAIN_ERRORS();
|
||||
Hide_errors = true;
|
||||
run("container foo [\n"
|
||||
" b:num\n"
|
||||
"]\n");
|
||||
CHECK_TRACE_CONTAINS_ERROR();
|
||||
CHECK_TRACE_CONTAINS_ERRORS();
|
||||
}
|
||||
|
||||
//:: Allow container definitions anywhere in the codebase, but complain if you
|
||||
|
|
|
@ -190,7 +190,7 @@ void run_mu_scenario(const scenario& s) {
|
|||
transform_all();
|
||||
run(tmp.front());
|
||||
// End Mu Test Teardown
|
||||
if (!Hide_errors && trace_count("error") > 0 && !Scenario_testing_scenario)
|
||||
if (!Hide_errors && trace_contains_errors() && !Scenario_testing_scenario)
|
||||
Passed = false;
|
||||
if (not_already_inside_test && Trace_stream) {
|
||||
teardown();
|
||||
|
@ -242,7 +242,7 @@ void test_maybe_make_raw() {
|
|||
bind_special_scenario_names(tmp.at(0));
|
||||
transform_all();
|
||||
run(tmp.at(0));
|
||||
CHECK_EQ(trace_count("error"), 0);
|
||||
CHECK_TRACE_DOESNT_CONTAIN_ERRORS();
|
||||
}
|
||||
|
||||
//: Watch out for redefinitions of scenario routines. We should never ever be
|
||||
|
|
|
@ -452,13 +452,13 @@ void test_new_fragment_after_tangle() {
|
|||
" 1:num/raw <- copy 34\n"
|
||||
"]\n");
|
||||
transform_all();
|
||||
CHECK_TRACE_DOESNT_CONTAIN_ERROR();
|
||||
CHECK_TRACE_DOESNT_CONTAIN_ERRORS();
|
||||
Hide_errors = true;
|
||||
// try to tangle into recipe foo after transform
|
||||
load("before <label> [\n"
|
||||
" 2:num/raw <- copy 35\n"
|
||||
"]\n");
|
||||
CHECK_TRACE_CONTAINS_ERROR();
|
||||
CHECK_TRACE_CONTAINS_ERRORS();
|
||||
}
|
||||
|
||||
:(before "End before Command Handler")
|
||||
|
|
Loading…
Reference in New Issue