about summary refs log tree commit diff stats
path: root/079table.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-26 16:46:38 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-26 16:46:38 -0700
commitad8161f34526599a94b12d38554cff9ac20467da (patch)
tree88261c5018d8582aa281889852f268a31f87c5fb /079table.mu
parentf88551d1bdc28afaa1c60c97205d152417e6f145 (diff)
downloadmu-ad8161f34526599a94b12d38554cff9ac20467da.tar.gz
3015 - more symbolic names in tests
There's still a problem: if I ever want to use any of the special
scenario variables like 'screen', 'console', etc., then I can't use
'local-scope' in my scenario.
Diffstat (limited to '079table.mu')
-rw-r--r--079table.mu22
1 files changed, 12 insertions, 10 deletions
diff --git a/079table.mu b/079table.mu
index 40b3ff34..4c98cf91 100644
--- a/079table.mu
+++ b/079table.mu
@@ -3,24 +3,26 @@
 
 scenario table-read-write [
   run [
-    1:address:table:number:number <- new-table 30
-    put 1:address:table:number:number, 12, 34
-    2:number <- index 1:address:table:number:number, 12
+    local-scope
+    tab:address:table:number:number <- new-table 30
+    put-index tab, 12, 34
+    1:number/raw <- index tab, 12
   ]
   memory-should-contain [
-    2 <- 34
+    1 <- 34
   ]
 ]
 
 scenario table-read-write-non-integer [
   run [
-    1:address:array:character <- new [abc def]
-    {2: (address table (address array character) number)} <- new-table 30
-    put {2: (address table (address array character) number)}, 1:address:array:character, 34
-    3:number <- index {2: (address table (address array character) number)}, 1:address:array:character
+    local-scope
+    key:address:array:character <- new [abc def]
+    {tab: (address table (address array character) number)} <- new-table 30
+    put-index tab, key, 34
+    1:number/raw <- index tab, key
   ]
   memory-should-contain [
-    3 <- 34
+    1 <- 34
   ]
 ]
 
@@ -44,7 +46,7 @@ def new-table capacity:number -> result:address:table:_key:_value [
   *result <- merge 0/length, capacity, data
 ]
 
-def put table:address:table:_key:_value, key:_key, value:_value -> table:address:table:_key:_value [
+def put-index table:address:table:_key:_value, key:_key, value:_value -> table:address:table:_key:_value [
   local-scope
   load-ingredients
   hash:number <- hash key