diff options
Diffstat (limited to 'html/050scenario.cc.html')
-rw-r--r-- | html/050scenario.cc.html | 44 |
1 files changed, 38 insertions, 6 deletions
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> |