about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-11 19:28:29 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-11 19:31:37 -0700
commitac8acc7b05774ac5777d5a03311728fb14d3f217 (patch)
treeae5d921ede8aed3332e282a9297f84ce06f7f7e1
parent1156971774b307bec29fab34a523eb39a7904174 (diff)
downloadmu-ac8acc7b05774ac5777d5a03311728fb14d3f217.tar.gz
2954 - bugfix: $system
The actual fix is in the layer rewriting literal strings.
-rw-r--r--029tools.cc5
-rw-r--r--064rewrite_literal_string.cc1
-rw-r--r--edit/005-sandbox.mu9
-rw-r--r--edit/008-sandbox-test.mu7
-rw-r--r--sandbox/005-sandbox.mu9
-rw-r--r--sandbox/008-sandbox-test.mu7
6 files changed, 19 insertions, 19 deletions
diff --git a/029tools.cc b/029tools.cc
index faab1eb0..364c6260 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -273,9 +273,12 @@ put(Recipe_ordinal, "$system", _SYSTEM);
 :(before "End Primitive Recipe Checks")
 case _SYSTEM: {
   if (SIZE(inst.ingredients) != 1) {
-    raise << maybe(get(Recipe, r).name) << "'$system' requires exactly one ingredient, but got none\n" << end();
+    raise << maybe(get(Recipe, r).name) << "'$system' requires exactly one ingredient, but got " << to_string(inst) << '\n' << end();
     break;
   }
+  if (!is_literal_string(inst.ingredients.at(0))) {
+    raise << maybe(get(Recipe, r).name) << "ingredient to '$system' must be a literal text, but got " << to_string(inst) << '\n' << end();
+  }
   break;
 }
 :(before "End Primitive Recipe Implementations")
diff --git a/064rewrite_literal_string.cc b/064rewrite_literal_string.cc
index 81260c5e..9eeeefaa 100644
--- a/064rewrite_literal_string.cc
+++ b/064rewrite_literal_string.cc
@@ -20,6 +20,7 @@ set<string> recipes_taking_literal_strings;
 :(code)
 void initialize_transform_rewrite_literal_string_to_text() {
   recipes_taking_literal_strings.insert("$print");
+  recipes_taking_literal_strings.insert("$system");
   recipes_taking_literal_strings.insert("trace");
   recipes_taking_literal_strings.insert("stash");
   recipes_taking_literal_strings.insert("assert");
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index 9ae94ee3..f331c356 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -329,14 +329,7 @@ def restore-sandboxes env:address:programming-environment-data -> env:address:pr
     # create new sandbox for file
     curr <- new sandbox-data:type
     *curr <- put *curr, data:offset, contents
-    # restore expected output for sandbox if it exists
-    {
-      filename <- append filename, [.out]
-      contents <- restore filename
-      break-unless contents
-      <end-restore-sandbox>
-    }
-    +continue
+    <end-restore-sandbox>
     {
       break-if idx
       *env <- put *env, sandbox:offset, curr
diff --git a/edit/008-sandbox-test.mu b/edit/008-sandbox-test.mu
index 98d1bf57..e15c79ec 100644
--- a/edit/008-sandbox-test.mu
+++ b/edit/008-sandbox-test.mu
@@ -99,7 +99,12 @@ before <end-save-sandbox> [
 ]
 
 before <end-restore-sandbox> [
-  *curr <- put *curr, expected-response:offset, contents
+  {
+    filename <- append filename, [.out]
+    contents <- restore filename
+    break-unless contents
+    *curr <- put *curr, expected-response:offset, contents
+  }
 ]
 
 # clicks on sandbox responses save it as 'expected'
diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu
index 01a6422c..8c7e80c6 100644
--- a/sandbox/005-sandbox.mu
+++ b/sandbox/005-sandbox.mu
@@ -321,14 +321,7 @@ def! restore-sandboxes env:address:programming-environment-data -> env:address:p
     # create new sandbox for file
     curr <- new sandbox-data:type
     *curr <- put *curr, data:offset, contents
-    # restore expected output for sandbox if it exists
-    {
-      filename <- append filename, [.out]
-      contents <- restore filename
-      break-unless contents
-      <end-restore-sandbox>
-    }
-    +continue
+    <end-restore-sandbox>
     {
       break-if idx
       *env <- put *env, sandbox:offset, curr
diff --git a/sandbox/008-sandbox-test.mu b/sandbox/008-sandbox-test.mu
index 61d12167..e88d7240 100644
--- a/sandbox/008-sandbox-test.mu
+++ b/sandbox/008-sandbox-test.mu
@@ -98,7 +98,12 @@ before <end-save-sandbox> [
 ]
 
 before <end-restore-sandbox> [
-  *curr <- put *curr, expected-response:offset, contents
+  {
+    filename <- append filename, [.out]
+    contents <- restore filename
+    break-unless contents
+    *curr <- put *curr, expected-response:offset, contents
+  }
 ]
 
 # clicks on sandbox responses save it as 'expected'