about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-05-30 00:24:16 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-05-30 00:24:16 -0700
commite568378ecb13a6d49d24a5b820a20f65cc9004dc (patch)
treedf34dd944aeb8312b18fef891331cf9656325a67
parentda21512440d0fea412ad43c3d0d340bba586a700 (diff)
downloadview.love-e568378ecb13a6d49d24a5b820a20f65cc9004dc.tar.gz
wait, fix tests
We had this problem because our test fakes were out of sync with reality.
And just in the source app.
-rw-r--r--app.lua28
1 files changed, 19 insertions, 9 deletions
diff --git a/app.lua b/app.lua
index b41b1ad..1d4a72b 100644
--- a/app.lua
+++ b/app.lua
@@ -316,16 +316,26 @@ end
 -- fake files
 function App.open_for_writing(filename)
   App.filesystem[filename] = ''
-  return {
-    write = function(self, ...)
-              local args = {...}
-              for i,s in ipairs(args) do
+  if Current_app == nil or Current_app == 'run' then
+    return {
+      write = function(self, ...)
+                local args = {...}
+                for i,s in ipairs(args) do
+                  App.filesystem[filename] = App.filesystem[filename]..s
+                end
+              end,
+      close = function(self)
+              end,
+    }
+  elseif Current_app == 'source' then
+    return {
+      write = function(self, s)
                 App.filesystem[filename] = App.filesystem[filename]..s
-              end
-            end,
-    close = function(self)
-            end,
-  }
+              end,
+      close = function(self)
+              end,
+    }
+  end
 end
 
 function App.open_for_reading(filename)