diff options
Diffstat (limited to 'html')
-rw-r--r-- | html/003trace.cc.html | 12 | ||||
-rw-r--r-- | html/011load.cc.html | 2 | ||||
-rw-r--r-- | html/020run.cc.html | 4 | ||||
-rw-r--r-- | html/030container.cc.html | 4 | ||||
-rw-r--r-- | html/038new_text.cc.html | 9 | ||||
-rw-r--r-- | html/050scenario.cc.html | 44 | ||||
-rw-r--r-- | html/052tangle.cc.html | 4 |
7 files changed, 62 insertions, 17 deletions
diff --git a/html/003trace.cc.html b/html/003trace.cc.html index 881a854f..7cb4e3e8 100644 --- a/html/003trace.cc.html +++ b/html/003trace.cc.html @@ -216,9 +216,13 @@ trace_stream* Trace_stream = <span class="Constant">NULL</span><span class="Deli <span class="Comment">// Inside tests, fail any tests that displayed (unexpected) errors.</span> <span class="Comment">// Expected errors in tests should always be hidden and silently checked for.</span> <span class="Delimiter">:(before "End Test Teardown")</span> -<span class="Normal">if</span> <span class="Delimiter">(</span>Passed && !Hide_errors && trace_count<span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">)</span> > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">if</span> <span class="Delimiter">(</span>Passed && !Hide_errors && trace_contains_errors<span class="Delimiter">())</span> <span class="Delimiter">{</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Delimiter">:(code)</span> +<span class="Normal">bool</span> trace_contains_errors<span class="Delimiter">()</span> <span class="Delimiter">{</span> + <span class="Identifier">return</span> Trace_errors > <span class="Constant">0</span> || trace_count<span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">)</span> > <span class="Constant">0</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> <span class="Delimiter">:(before "End Types")</span> <span class="Normal">struct</span> end <span class="Delimiter">{};</span> @@ -256,9 +260,9 @@ START_TRACING_UNTIL_END_OF_SCOPE <span class="Delimiter">:(before "End Includes")</span> <span class="PreProc">#define CHECK_TRACE_CONTENTS(</span><span class="Delimiter">...</span><span class="PreProc">) check_trace_contents(__FUNCTION__</span><span class="Delimiter">,</span><span class="PreProc"> </span><span class="Constant">__FILE__</span><span class="Delimiter">,</span><span class="PreProc"> </span><span class="Constant">__LINE__</span><span class="Delimiter">,</span><span class="PreProc"> __VA_ARGS__)</span> -<span class="PreProc">#define CHECK_TRACE_CONTAINS_ERROR() CHECK(trace_count(</span><span class="Constant">"error"</span><span class="PreProc">) > </span><span class="Constant">0</span><span class="PreProc">)</span> -<span class="PreProc">#define CHECK_TRACE_DOESNT_CONTAIN_ERROR() \</span> -<span class="PreProc"> </span><span class="Normal">if</span><span class="PreProc"> (Passed && trace_count(</span><span class="Constant">"error"</span><span class="PreProc">) > </span><span class="Constant">0</span><span class="PreProc">) </span><span class="Delimiter">{</span><span class="PreProc"> \</span> +<span class="PreProc">#define CHECK_TRACE_CONTAINS_ERRORS() CHECK(trace_contains_errors())</span> +<span class="PreProc">#define CHECK_TRACE_DOESNT_CONTAIN_ERRORS() \</span> +<span class="PreProc"> </span><span class="Normal">if</span><span class="PreProc"> (Passed && trace_contains_errors()) </span><span class="Delimiter">{</span><span class="PreProc"> \</span> <span class="PreProc"> cerr << </span><span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span><span class="PreProc"> << __FUNCTION__ << </span><span class="Constant">"("</span><span class="PreProc"> << </span><span class="Constant">__FILE__</span><span class="PreProc"> << </span><span class="Constant">":"</span><span class="PreProc"> << </span><span class="Constant">__LINE__</span><span class="PreProc"> << </span><span class="Constant">"): unexpected errors</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span><span class="PreProc"> \</span> <span class="PreProc"> DUMP(</span><span class="Constant">"error"</span><span class="PreProc">)</span><span class="Delimiter">;</span><span class="PreProc"> \</span> <span class="PreProc"> Passed = </span><span class="Constant">false</span><span class="Delimiter">;</span><span class="PreProc"> \</span> diff --git a/html/011load.cc.html b/html/011load.cc.html index 065fd491..29c00134 100644 --- a/html/011load.cc.html +++ b/html/011load.cc.html @@ -214,7 +214,7 @@ string next_word<span class="Delimiter">(</span>istream& in<span class="Deli <span class="Normal">bool</span> is_label_word<span class="Delimiter">(</span><span class="Normal">const</span> string& word<span class="Delimiter">)</span> <span class="Delimiter">{</span> assert<span class="Delimiter">(</span>!word<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> - <span class="Identifier">return</span> !isalnum<span class="Delimiter">(</span>word<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> && string<span class="Delimiter">(</span><span class="Constant">"$_*@&,=-"</span><span class="Delimiter">).</span>find<span class="Delimiter">(</span>word<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> == string::npos<span class="Delimiter">;</span> + <span class="Identifier">return</span> !isalnum<span class="Delimiter">(</span>word<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> && string<span class="Delimiter">(</span><span class="Constant">"$_*@&,=-[]()"</span><span class="Delimiter">).</span>find<span class="Delimiter">(</span>word<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> == string::npos<span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Normal">bool</span> ends_with<span class="Delimiter">(</span><span class="Normal">const</span> string& s<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">char</span> c<span class="Delimiter">)</span> <span class="Delimiter">{</span> diff --git a/html/020run.cc.html b/html/020run.cc.html index d036a7fb..be5baa4c 100644 --- a/html/020run.cc.html +++ b/html/020run.cc.html @@ -216,7 +216,7 @@ load_file_or_directory<span class="Delimiter">(</span><span class="Constant">&qu transform_all<span class="Delimiter">();</span> <span class="CommentedCode">//? DUMP("");</span> <span class="CommentedCode">//? exit(0);</span> -<span class="Normal">if</span> <span class="Delimiter">(</span>Trace_errors<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span> +<span class="Normal">if</span> <span class="Delimiter">(</span>trace_contains_errors<span class="Delimiter">())</span> <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span> save_snapshots<span class="Delimiter">();</span> <span class="Comment">//: Step 3: if we aren't running tests, locate a recipe called 'main' and</span> @@ -413,7 +413,7 @@ vector<<span class="Normal">double</span>> read_memory<span class="Delimit vector<recipe_ordinal> tmp = load<span class="Delimiter">(</span>form<span class="Delimiter">);</span> transform_all<span class="Delimiter">();</span> <span class="Normal">if</span> <span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>trace_count<span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">)</span> > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>trace_contains_errors<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// if a test defines main, it probably wants to start there regardless of</span> <span class="Comment">// definition order</span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">)))</span> diff --git a/html/030container.cc.html b/html/030container.cc.html index 6948c628..f474b8b8 100644 --- a/html/030container.cc.html +++ b/html/030container.cc.html @@ -818,12 +818,12 @@ assert<span class="Delimiter">(</span>Next_type_ordinal < <span class="Consta <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> <span class="Comment">// try to extend the container after transform</span> transform_all<span class="Delimiter">();</span> - CHECK_TRACE_DOESNT_CONTAIN_ERROR<span class="Delimiter">();</span> + CHECK_TRACE_DOESNT_CONTAIN_ERRORS<span class="Delimiter">();</span> Hide_errors = <span class="Constant">true</span><span class="Delimiter">;</span> run<span class="Delimiter">(</span><span class="Constant">"container foo [</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span class="Constant">" b:num</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> - CHECK_TRACE_CONTAINS_ERROR<span class="Delimiter">();</span> + CHECK_TRACE_CONTAINS_ERRORS<span class="Delimiter">();</span> <span class="Delimiter">}</span> <span class="SalientComment">//:: Allow container definitions anywhere in the codebase, but complain if you</span> diff --git a/html/038new_text.cc.html b/html/038new_text.cc.html index f86c1683..8656f8a3 100644 --- a/html/038new_text.cc.html +++ b/html/038new_text.cc.html @@ -98,6 +98,15 @@ put<span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</ <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Comment">//: a new kind of typo</span> + +<span class="Delimiter">:(scenario string_literal_without_instruction)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> main [ + [abc] +] +<span class="traceContains">+error: main: instruction '[abc]' has no recipe</span> + <span class="Comment">//: stash recognizes strings</span> <span class="Delimiter">:(scenario stash_string)</span> diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index bda57dbd..c93d68a9 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -96,6 +96,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Normal">struct</span> scenario <span class="Delimiter">{</span> string name<span class="Delimiter">;</span> string to_run<span class="Delimiter">;</span> + <span class="Normal">void</span> clear<span class="Delimiter">()</span> <span class="Delimiter">{</span> + name<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> + to_run<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> + <span class="Delimiter">}</span> <span class="Delimiter">};</span> <span class="Delimiter">:(before "End Globals")</span> @@ -106,7 +110,9 @@ vector<scenario> Scenarios<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Command Handlers")</span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">"scenario"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> - Scenarios<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>parse_scenario<span class="Delimiter">(</span>in<span class="Delimiter">));</span> + scenario result = parse_scenario<span class="Delimiter">(</span>in<span class="Delimiter">);</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!result<span class="Delimiter">.</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> + Scenarios<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> <span class="Delimiter">}</span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">"pending-scenario"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// for temporary use only</span> @@ -131,9 +137,17 @@ vector<scenario> Scenarios<span class="Delimiter">;</span> <span class="Comment">// inside comments</span> result<span class="Delimiter">.</span>to_run = slurp_quoted<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span class="Comment">// delete [] delimiters</span> - assert<span class="Delimiter">(</span>starts_with<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">,</span> <span class="Constant">"["</span><span class="Delimiter">));</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!starts_with<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">,</span> <span class="Constant">"["</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + raise << <span class="Constant">"scenario "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" should start with '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + result<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> + <span class="Identifier">return</span> result<span class="Delimiter">;</span> + <span class="Delimiter">}</span> result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>erase<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>at<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">)</span> == <span class="Constant">']'</span><span class="Delimiter">);</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>at<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">)</span> != <span class="Constant">']'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + raise << <span class="Constant">"scenario "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" has an unbalanced '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + result<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> + <span class="Identifier">return</span> result<span class="Delimiter">;</span> + <span class="Delimiter">}</span> result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">);</span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -227,9 +241,10 @@ Hide_missing_default_space_errors = <span class="Constant">false</span><span cla mark_autogenerated<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> bind_special_scenario_names<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> transform_all<span class="Delimiter">();</span> - run<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>front<span class="Delimiter">());</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!trace_contains_errors<span class="Delimiter">())</span> + run<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>front<span class="Delimiter">());</span> <span class="Comment">// End Mu Test Teardown</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors && trace_count<span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">)</span> > <span class="Constant">0</span> && !Scenario_testing_scenario<span class="Delimiter">)</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors && trace_contains_errors<span class="Delimiter">()</span> && !Scenario_testing_scenario<span class="Delimiter">)</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Normal">if</span> <span class="Delimiter">(</span>not_already_inside_test && Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> teardown<span class="Delimiter">();</span> @@ -281,7 +296,7 @@ Name[r][<span class="Constant">"__maybe_make_raw_test__"</span>] = Res bind_special_scenario_names<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> transform_all<span class="Delimiter">();</span> run<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> - CHECK_EQ<span class="Delimiter">(</span>trace_count<span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">),</span> <span class="Constant">0</span><span class="Delimiter">);</span> + CHECK_TRACE_DOESNT_CONTAIN_ERRORS<span class="Delimiter">();</span> <span class="Delimiter">}</span> <span class="Comment">//: Watch out for redefinitions of scenario routines. We should never ever be</span> @@ -298,6 +313,23 @@ Name[r][<span class="Constant">"__maybe_make_raw_test__"</span>] = Res ] <span class="traceContains">+error: redefining recipe scenario-foo</span> +<span class="Delimiter">:(scenario scenario_containing_parse_error)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muScenario">scenario</span> foo [ + memory-should-contain [ + <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Comment"># missing ']'</span> +] +<span class="Comment"># no crash</span> + +<span class="Delimiter">:(scenario scenario_containing_transform_error)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> main [ + local-scope + add x<span class="Delimiter">,</span> <span class="Constant">1</span> +] +<span class="Comment"># no crash</span> + <span class="Delimiter">:(after "bool should_check_for_redefine(const string& recipe_name)")</span> <span class="Normal">if</span> <span class="Delimiter">(</span>recipe_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"scenario-"</span><span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> diff --git a/html/052tangle.cc.html b/html/052tangle.cc.html index 4aff0513..0b0b51c2 100644 --- a/html/052tangle.cc.html +++ b/html/052tangle.cc.html @@ -488,13 +488,13 @@ $mem: <span class="Constant">2</span> <span class="Constant">" 1:num/raw <- copy 34</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> transform_all<span class="Delimiter">();</span> - CHECK_TRACE_DOESNT_CONTAIN_ERROR<span class="Delimiter">();</span> + CHECK_TRACE_DOESNT_CONTAIN_ERRORS<span class="Delimiter">();</span> Hide_errors = <span class="Constant">true</span><span class="Delimiter">;</span> <span class="Comment">// try to tangle into recipe foo after transform</span> load<span class="Delimiter">(</span><span class="Constant">"before <label> [</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span class="Constant">" 2:num/raw <- copy 35</span><span class="cSpecial">\n</span><span class="Constant">"</span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> - CHECK_TRACE_CONTAINS_ERROR<span class="Delimiter">();</span> + CHECK_TRACE_CONTAINS_ERRORS<span class="Delimiter">();</span> <span class="Delimiter">}</span> <span class="Delimiter">:(before "End before Command Handler")</span> |