diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-07-20 18:05:56 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-07-20 18:05:56 -0700 |
commit | e81da299fb49bd79cd460d477ec0bb673035620a (patch) | |
tree | e4b162be797dcb6d2793a5f7831c6c39bd099a85 /html/050scenario.cc.html | |
parent | edfc4cf8ac21a30307cd36bb9cff6a4a8b92dee7 (diff) | |
download | mu-e81da299fb49bd79cd460d477ec0bb673035620a.tar.gz |
3117
Diffstat (limited to 'html/050scenario.cc.html')
-rw-r--r-- | html/050scenario.cc.html | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index e8a8d028..213874ff 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -69,6 +69,7 @@ scenario foo [ <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">13</span> ] ] +<span class="Comment"># checks are inside scenario</span> <span class="Delimiter">:(scenario scenario_check_memory_and_trace)</span> scenario foo [ @@ -86,6 +87,7 @@ scenario foo [ <span class="Normal">a</span>: x y z ] ] +<span class="Comment"># checks are inside scenario</span> <span class="SalientComment">//:: Core data structure</span> @@ -257,7 +259,6 @@ Name[r][<span class="Constant">"__maybe_make_raw_test__"</span>] = Res def scenario-foo [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span> ] - def scenario-foo [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">35</span> ] @@ -540,7 +541,7 @@ def main [ <span class="Normal">a</span>: d ] ] -<span class="traceContains">+error: missing [b] in trace with label a</span> +<span class="traceContains">+error: missing [b] in trace with label 'a'</span> <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> TRACE_SHOULD_CONTAIN<span class="Delimiter">,</span> @@ -573,8 +574,14 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Normal">if</span> <span class="Delimiter">(</span>curr_expected_line == SIZE<span class="Delimiter">(</span>expected_lines<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - raise << <span class="Constant">"missing ["</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>contents << <span class="Constant">"] "</span> - << <span class="Constant">"in trace with label "</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>label << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>Current_scenario && !Scenario_testing_scenario<span class="Delimiter">)</span> + raise << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << Current_scenario<span class="Delimiter">-></span>name << <span class="Constant">": missing ["</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>contents << <span class="Constant">"] "</span> + << <span class="Constant">"in trace with label '"</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>label << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Normal">else</span> + raise << <span class="Constant">"missing ["</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>contents << <span class="Constant">"] "</span> + << <span class="Constant">"in trace with label '"</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>label << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> + DUMP<span class="Delimiter">(</span>expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>label<span class="Delimiter">);</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -602,7 +609,7 @@ def main [ <span class="Normal">a</span>: d ] ] -<span class="traceContains">+error: missing [d] in trace with label a</span> +<span class="traceContains">+error: missing [d] in trace with label 'a'</span> <span class="Delimiter">:(scenario trace_check_passes_silently)</span> <span class="Special">% Scenario_testing_scenario = true;</span> @@ -614,7 +621,7 @@ def main [ <span class="Normal">a</span>: b ] ] -<span class="traceAbsent">-error: missing [b] in trace with label a</span> +<span class="traceAbsent">-error: missing [b] in trace with label 'a'</span> $error: <span class="Constant">0</span> <span class="Comment">//: 'trace-should-not-contain' is like the '-' lines in our scenarios so far</span> @@ -632,7 +639,7 @@ def main [ <span class="Normal">a</span>: b ] ] -<span class="traceContains">+error: unexpected [b] in trace with label a</span> +<span class="traceContains">+error: unexpected [b] in trace with label 'a'</span> <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> TRACE_SHOULD_NOT_CONTAIN<span class="Delimiter">,</span> @@ -657,7 +664,7 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span vector<trace_line> lines = parse_trace<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>lines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>trace_count<span class="Delimiter">(</span>lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>label<span class="Delimiter">,</span> lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>contents<span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> - raise << <span class="Constant">"unexpected ["</span> << lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>contents << <span class="Constant">"] in trace with label "</span> << lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>label << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> + raise << <span class="Constant">"unexpected ["</span> << lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>contents << <span class="Constant">"] in trace with label '"</span> << lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>label << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -672,7 +679,7 @@ def main [ <span class="Normal">a</span>: b ] ] -<span class="traceAbsent">-error: unexpected [b] in trace with label a</span> +<span class="traceAbsent">-error: unexpected [b] in trace with label 'a'</span> $error: <span class="Constant">0</span> <span class="Delimiter">:(scenario trace_negative_check_fails_on_any_unexpected_line)</span> @@ -687,7 +694,7 @@ def main [ <span class="Normal">a</span>: d ] ] -<span class="traceContains">+error: unexpected [d] in trace with label a</span> +<span class="traceContains">+error: unexpected [d] in trace with label 'a'</span> <span class="Delimiter">:(scenario trace_count_check)</span> def main [ @@ -696,6 +703,7 @@ def main [ ] check-trace-count-<span class="Normal">for</span>-label <span class="Constant">1</span><span class="Delimiter">,</span> [a] ] +<span class="Comment"># checks are inside scenario</span> <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> CHECK_TRACE_COUNT_FOR_LABEL<span class="Delimiter">,</span> @@ -726,12 +734,12 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Normal">if</span> <span class="Delimiter">(</span>count != expected_count<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_scenario && !Scenario_testing_scenario<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// genuine test in a mu file</span> - raise << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << Current_scenario<span class="Delimiter">-></span>name << <span class="Constant">": "</span> << maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> << <span class="Constant">"expected "</span> << expected_count << <span class="Constant">" lines in trace with label "</span> << label << <span class="Constant">" in trace: "</span> << end<span class="Delimiter">();</span> + raise << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << Current_scenario<span class="Delimiter">-></span>name << <span class="Constant">": "</span> << maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> << <span class="Constant">"expected "</span> << expected_count << <span class="Constant">" lines in trace with label '"</span> << label << <span class="Constant">"' in trace: "</span> << end<span class="Delimiter">();</span> DUMP<span class="Delimiter">(</span>label<span class="Delimiter">);</span> <span class="Delimiter">}</span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span class="Comment">// just testing scenario support</span> - raise << maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> << <span class="Constant">"expected "</span> << expected_count << <span class="Constant">" lines in trace with label "</span> << label << <span class="Constant">" in trace</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + raise << maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> << <span class="Constant">"expected "</span> << expected_count << <span class="Constant">" lines in trace with label '"</span> << label << <span class="Constant">"' in trace</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span class="Delimiter">}</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> <span class="Delimiter">{</span> Passed = <span class="Constant">false</span><span class="Delimiter">;</span> @@ -750,7 +758,7 @@ def main [ ] check-trace-count-<span class="Normal">for</span>-label <span class="Constant">2</span><span class="Delimiter">,</span> [a] ] -<span class="traceContains">+error: main: expected 2 lines in trace with label a in trace</span> +<span class="traceContains">+error: main: expected 2 lines in trace with label 'a' in trace</span> <span class="Comment">//: Minor detail: ignore 'system' calls in scenarios, since anything we do</span> <span class="Comment">//: with them is by definition impossible to test through mu.</span> |