about summary refs log tree commit diff stats
path: root/html/090scenario_filesystem_test.mu.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-12-11 15:31:04 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-12-11 15:31:04 -0800
commitd5c86dfd8706e6b3ceee7843464797e6fcad4259 (patch)
tree34f07b48140270e32e0a3eefe136ece090db2170 /html/090scenario_filesystem_test.mu.html
parente7f65b0a4b0af23f5107fb44b8dc39514411589d (diff)
downloadmu-d5c86dfd8706e6b3ceee7843464797e6fcad4259.tar.gz
3704
Bugfix: writing to a new file in a non-empty fake file system.

The one time I try to get a little clever, it bites me in the ass.
That'll teach me..
Diffstat (limited to 'html/090scenario_filesystem_test.mu.html')
-rw-r--r--html/090scenario_filesystem_test.mu.html21
1 files changed, 20 insertions, 1 deletions
diff --git a/html/090scenario_filesystem_test.mu.html b/html/090scenario_filesystem_test.mu.html
index f82e26e0..91d039bb 100644
--- a/html/090scenario_filesystem_test.mu.html
+++ b/html/090scenario_filesystem_test.mu.html
@@ -55,7 +55,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   ]
 ]
 
-<span class="muScenario">scenario</span> write-to-fake-file [
+<span class="muScenario">scenario</span> write-to-new-fake-file [
   <span class="Constant">local-scope</span>
   assume-resources [
   ]
@@ -71,6 +71,25 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   ]
 ]
 
+<span class="muScenario">scenario</span> write-to-new-fake-file-2 [
+  <span class="Constant">local-scope</span>
+  assume-resources [
+    <span class="Constant">[a]</span> <span class="Special">&lt;-</span> [
+<span class="Constant">      |abc|</span>
+    ]
+  ]
+  sink:&amp;:sink:char, writer:num/routine <span class="Special">&lt;-</span> start-writing resources, <span class="Constant">[b]</span>
+  sink <span class="Special">&lt;-</span> write sink, <span class="Constant">120/x</span>
+  sink <span class="Special">&lt;-</span> write sink, <span class="Constant">121/y</span>
+  close sink
+  wait-for-routine writer
+  contents-read-back:text <span class="Special">&lt;-</span> slurp resources, <span class="Constant">[b]</span>
+  10:bool/<span class="Special">raw</span> <span class="Special">&lt;-</span> equal contents-read-back, <span class="Constant">[xy]</span>
+  memory-should-contain [
+   <span class="Constant"> 10</span> <span class="Special">&lt;-</span><span class="Constant"> 1</span>  <span class="Comment"># file contents read back exactly match what was written</span>
+  ]
+]
+
 <span class="muScenario">scenario</span> write-to-fake-file-that-exists [
   <span class="Constant">local-scope</span>
   assume-resources [