about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-12-25 19:39:32 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-12-25 19:39:39 -0800
commit19f02639b5f5c047d4e50c29a3774e36fa64316b (patch)
tree1eaeb521acaa42e302f9a51eea75e4ea1be67c90
parent11d454a53915bc65e85bc8db8a77e3d87b924e33 (diff)
downloadmu-19f02639b5f5c047d4e50c29a3774e36fa64316b.tar.gz
446
Clear up that ancient todo.

We don't particularly care about what abstraction we write tests at, as
long as we do so at *some* layer and document the intent. That lets us
move tests up or down in the future when we know more/have better taste.
-rw-r--r--mu.arc1
-rw-r--r--mu.arc.t20
2 files changed, 19 insertions, 2 deletions
diff --git a/mu.arc b/mu.arc
index ef813034..757208c7 100644
--- a/mu.arc
+++ b/mu.arc
@@ -335,6 +335,7 @@
   (point return
     (for ninstrs 0 (< ninstrs time-slice) (++ ninstrs)
       (if (empty body.routine*) (err "@stack.routine*.0!fn-name not defined"))
+      ; falling out of end of function = implicit reply
       (while (>= pc.routine* (len body.routine*))
         (pop-stack routine*)
         (if empty.routine* (return ninstrs))
diff --git a/mu.arc.t b/mu.arc.t
index 4ef4338a..b6788d9a 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -1044,6 +1044,24 @@
 ;? (quit)
 
 (reset)
+(new-trace "reply-increments-caller-pc")
+(add-code
+  '((function callee [
+      (reply)
+     ])
+    (function caller [
+      (1:integer <- copy 0:literal)
+      (2:integer <- copy 0:literal)
+     ])))
+(freeze-functions)
+(= routine* (make-routine 'caller))
+(assert (is 0 pc.routine*))
+(push-stack routine* 'callee)  ; pretend call was at first instruction of caller
+(run-for-time-slice 1)
+(if (~is 1 pc.routine*)
+  (prn "F - 'reply' should increment pc in caller (to move past calling instruction)"))
+
+(reset)
 (new-trace "new-fn-arg-sequential")
 (add-code
   '((function test1 [
@@ -2131,8 +2149,6 @@
   (prn "F - an example function that checks that its oarg is an integer"))
 ;? (quit)
 
-; todo - test that reply increments pc for caller frame after popping current frame
-
 (reset)
 (new-trace "dispatch-otype-multiple-clauses")
 ;? (set dump-trace*)