about summary refs log tree commit diff stats
path: root/090scenario_filesystem_test.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-26 11:27:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-26 11:27:13 -0700
commit0230a6cc0bf7fc78fe34242300e7a93498d97dd9 (patch)
tree1b5f16026522c3a57be8eaec7a179a17e15ddddd /090scenario_filesystem_test.mu
parent3c261c4426144c9b6873779f6a3e49c41f8d1f45 (diff)
downloadmu-0230a6cc0bf7fc78fe34242300e7a93498d97dd9.tar.gz
3256
Bugfix in filesystem creation. I'm sure there are other fake-filesystem
bugs.
Diffstat (limited to '090scenario_filesystem_test.mu')
-rw-r--r--090scenario_filesystem_test.mu24
1 files changed, 24 insertions, 0 deletions
diff --git a/090scenario_filesystem_test.mu b/090scenario_filesystem_test.mu
index 02343cba..b959c141 100644
--- a/090scenario_filesystem_test.mu
+++ b/090scenario_filesystem_test.mu
@@ -55,6 +55,30 @@ scenario write-to-fake-file-that-exists [
   ]
 ]
 
+scenario write-to-existing-file-preserves-other-files [
+  local-scope
+  assume-filesystem [
+    [a] <- []
+    [b] <- [
+      |bcd|
+    ]
+  ]
+  sink:address:sink:character, writer:number/routine <- start-writing filesystem:address:filesystem, [a]
+  sink <- write sink, 120/x
+  sink <- write sink, 121/y
+  close sink
+  wait-for-routine writer
+  contents-read-back:address:array:character <- slurp filesystem, [a]
+  10:boolean/raw <- equal contents-read-back, [xy]
+  other-file-contents:address:array:character <- slurp filesystem, [b]
+  11:boolean/raw <- equal other-file-contents, [bcd
+]
+  memory-should-contain [
+    10 <- 1  # file contents read back exactly match what was written
+    11 <- 1  # other files also continue to persist unchanged
+  ]
+]
+
 def slurp fs:address:filesystem, filename:address:array:character -> contents:address:array:character [
   local-scope
   load-ingredients