diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-05-26 16:46:38 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-05-26 16:46:38 -0700 |
commit | ad8161f34526599a94b12d38554cff9ac20467da (patch) | |
tree | 88261c5018d8582aa281889852f268a31f87c5fb /079table.mu | |
parent | f88551d1bdc28afaa1c60c97205d152417e6f145 (diff) | |
download | mu-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.mu | 22 |
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 |