about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-14 16:06:53 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-14 16:06:53 -0800
commit631d3b4e98183d800bc9777e88cca339ad063d35 (patch)
tree6f29a52fcec6e539b76be2222ad10e664cf139be
parent2674966e94b861f5c90021ff02d20dff9b0a70fc (diff)
downloadmu-631d3b4e98183d800bc9777e88cca339ad063d35.tar.gz
563 - check actual errors during move validation
-rw-r--r--chessboard-cursor.arc.t8
-rw-r--r--mu.arc7
2 files changed, 11 insertions, 4 deletions
diff --git a/chessboard-cursor.arc.t b/chessboard-cursor.arc.t
index d52183a2..f3ff8c4a 100644
--- a/chessboard-cursor.arc.t
+++ b/chessboard-cursor.arc.t
@@ -96,7 +96,9 @@
 (run 'main)
 ;? (each routine completed-routines*
 ;?   (prn "  " routine))
-(if (ran-to-completion 'read-file)
+(if (or (ran-to-completion 'read-file)
+        (let routine routine-running!read-file
+          (~posmatch "file too high" rep.routine!error)))
   (prn "F - 'read-file' checks that file lies between 'a' and 'h'"))
 
 (reset)
@@ -113,7 +115,9 @@
       (sleep until-routine-done:literal r:integer/routine)
      ])))
 (run 'main)
-(if (ran-to-completion 'read-rank)
+(if (or (ran-to-completion 'read-rank)
+        (let routine routine-running!read-rank
+          (~posmatch "rank too high" rep.routine!error)))
   (prn "F - 'read-rank' checks that rank lies between '1' and '8'"))
 
 (reset)
diff --git a/mu.arc b/mu.arc
index 311f33a8..7ac07295 100644
--- a/mu.arc
+++ b/mu.arc
@@ -1415,11 +1415,14 @@
              :else
                (recur (+ addr 1) (+ idx 1))))))
 
+(def routine-running (f)
+  (find [some [is f _!fn-name] stack._]
+        completed-routines*))
+
 (def ran-to-completion (f)
   ; if a routine calling f ran to completion there'll be no sign of it in any
   ; completed call-stacks.
-  (~find [some [is f _!fn-name] stack._]
-         completed-routines*))
+  (~routine-running f))
 
 ;; system software
 ; create once, load before every test