about summary refs log tree commit diff stats
path: root/html
diff options
context:
space:
mode:
Diffstat (limited to 'html')
-rw-r--r--html/003trace.cc.html12
-rw-r--r--html/011load.cc.html2
-rw-r--r--html/020run.cc.html4
-rw-r--r--html/030container.cc.html4
-rw-r--r--html/038new_text.cc.html9
-rw-r--r--html/050scenario.cc.html44
-rw-r--r--html/052tangle.cc.html4
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 &quot;End Test Teardown&quot;)</span>
-<span class="Normal">if</span> <span class="Delimiter">(</span>Passed &amp;&amp; !Hide_errors &amp;&amp; trace_count<span class="Delimiter">(</span><span class="Constant">&quot;error&quot;</span><span class="Delimiter">)</span> &gt; <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
+<span class="Normal">if</span> <span class="Delimiter">(</span>Passed &amp;&amp; !Hide_errors &amp;&amp; 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 &gt; <span class="Constant">0</span> || trace_count<span class="Delimiter">(</span><span class="Constant">&quot;error&quot;</span><span class="Delimiter">)</span> &gt; <span class="Constant">0</span><span class="Delimiter">;</span>
+<span class="Delimiter">}</span>
 
 <span class="Delimiter">:(before &quot;End Types&quot;)</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 &quot;End Includes&quot;)</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">&quot;error&quot;</span><span class="PreProc">) &gt; </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 &amp;&amp; trace_count(</span><span class="Constant">&quot;error&quot;</span><span class="PreProc">) &gt; </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 &amp;&amp; trace_contains_errors()) </span><span class="Delimiter">{</span><span class="PreProc"> \</span>
 <span class="PreProc">    cerr &lt;&lt; </span><span class="Constant">&quot;</span><span class="cSpecial">\n</span><span class="Constant">F - &quot;</span><span class="PreProc"> &lt;&lt; __FUNCTION__ &lt;&lt; </span><span class="Constant">&quot;(&quot;</span><span class="PreProc"> &lt;&lt; </span><span class="Constant">__FILE__</span><span class="PreProc"> &lt;&lt; </span><span class="Constant">&quot;:&quot;</span><span class="PreProc"> &lt;&lt; </span><span class="Constant">__LINE__</span><span class="PreProc"> &lt;&lt; </span><span class="Constant">&quot;): unexpected errors</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span><span class="Delimiter">;</span><span class="PreProc"> \</span>
 <span class="PreProc">    DUMP(</span><span class="Constant">&quot;error&quot;</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&amp; in<span class="Deli
 
 <span class="Normal">bool</span> is_label_word<span class="Delimiter">(</span><span class="Normal">const</span> string&amp; 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> &amp;&amp; string<span class="Delimiter">(</span><span class="Constant">&quot;$_*@&amp;,=-&quot;</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> &amp;&amp; string<span class="Delimiter">(</span><span class="Constant">&quot;$_*@&amp;,=-[]()&quot;</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&amp; 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(&quot;&quot;);</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&lt;<span class="Normal">double</span>&gt; read_memory<span class="Delimit
   vector&lt;recipe_ordinal&gt; 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">&quot;error&quot;</span><span class="Delimiter">)</span> &gt; <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">&quot;main&quot;</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 &lt; <span class="Consta
       <span class="Constant">&quot;]</span><span class="cSpecial">\n</span><span class="Constant">&quot;</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">&quot;container foo [</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
       <span class="Constant">&quot;  b:num</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
       <span class="Constant">&quot;]</span><span class="cSpecial">\n</span><span class="Constant">&quot;</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 &quot;End Globals&quot;)</span>
@@ -106,7 +110,9 @@ vector&lt;scenario&gt; Scenarios<span class="Delimiter">;</span>
 
 <span class="Delimiter">:(before &quot;End Command Handlers&quot;)</span>
 <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">&quot;scenario&quot;</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">&quot;pending-scenario&quot;</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
   <span class="Comment">// for temporary use only</span>
@@ -131,9 +137,17 @@ vector&lt;scenario&gt; 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">&quot;[&quot;</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">&quot;[&quot;</span><span class="Delimiter">))</span> <span class="Delimiter">{</span>
+    raise &lt;&lt; <span class="Constant">&quot;scenario &quot;</span> &lt;&lt; result<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">&quot; should start with '['</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; 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 &lt;&lt; <span class="Constant">&quot;scenario &quot;</span> &lt;&lt; result<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">&quot; has an unbalanced '['</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; 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 &amp;&amp; trace_count<span class="Delimiter">(</span><span class="Constant">&quot;error&quot;</span><span class="Delimiter">)</span> &gt; <span class="Constant">0</span> &amp;&amp; !Scenario_testing_scenario<span class="Delimiter">)</span>
+  <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors &amp;&amp; trace_contains_errors<span class="Delimiter">()</span> &amp;&amp; !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 &amp;&amp; Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span>
     teardown<span class="Delimiter">();</span>
@@ -281,7 +296,7 @@ Name[r][<span class="Constant">&quot;__maybe_make_raw_test__&quot;</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">&quot;error&quot;</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">&quot;__maybe_make_raw_test__&quot;</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"> &lt;- </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 &quot;bool should_check_for_redefine(const string&amp; recipe_name)&quot;)</span>
   <span class="Normal">if</span> <span class="Delimiter">(</span>recipe_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;scenario-&quot;</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">&quot;  1:num/raw &lt;- copy 34</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
        <span class="Constant">&quot;]</span><span class="cSpecial">\n</span><span class="Constant">&quot;</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">&quot;before &lt;label&gt; [</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
        <span class="Constant">&quot;  2:num/raw &lt;- copy 35</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
        <span class="Constant">&quot;]</span><span class="cSpecial">\n</span><span class="Constant">&quot;</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 &quot;End before Command Handler&quot;)</span>