diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-21 09:26:30 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-11-21 09:27:25 -0800 |
commit | 167d0ca0d62f46598ea7385a11fa64ec935b5269 (patch) | |
tree | 8d6031f7fa1830ccdf71d391aeec1e35d4966c32 | |
parent | fe9f07155abf6e5326d0e27c1b367181f0fcbfa8 (diff) | |
download | mu-167d0ca0d62f46598ea7385a11fa64ec935b5269.tar.gz |
2466 - eliminate ':string' from scenarios
-rw-r--r-- | 050scenario.cc | 9 | ||||
-rw-r--r-- | 051scenario_test.mu | 2 | ||||
-rw-r--r-- | 070string.mu | 62 | ||||
-rw-r--r-- | edit/005-sandbox.mu | 2 | ||||
-rw-r--r-- | sandbox/005-sandbox.mu | 2 |
5 files changed, 40 insertions, 37 deletions
diff --git a/050scenario.cc b/050scenario.cc index 9f4c5c86..6b785d5c 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -309,7 +309,10 @@ void check_memory(const string& s) { void check_type(const string& lhs, istream& in) { reagent x(lhs); - if (x.properties.at(0).second->value == "string") { + const string_tree* type_name = x.properties.at(0).second; + if (type_name->value == "array" + && type_name->right && type_name->right->value == "character" + && !type_name->right->right) { x.set_value(to_integer(x.name)); skip_whitespace_and_comments(in); string _assign = next_word(in); @@ -380,7 +383,7 @@ recipe main [ 3:number <- copy 98 # 'b' 4:number <- copy 99 # 'c' memory-should-contain [ - 1:string <- [ab] + 1:array:character <- [ab] ] ] +error: expected location 1 to contain length 2 of string [ab] but saw 3 @@ -392,7 +395,7 @@ recipe main [ 3:number <- copy 98 # 'b' 4:number <- copy 99 # 'c' memory-should-contain [ - 1:string <- [abc] + 1:array:character <- [abc] ] ] +run: checking string length at 1 diff --git a/051scenario_test.mu b/051scenario_test.mu index 7767451b..3e2e5462 100644 --- a/051scenario_test.mu +++ b/051scenario_test.mu @@ -38,7 +38,7 @@ scenario check_string_in_memory [ 4:character <- copy 99 # 'c' ] memory-should-contain [ - 1:string <- [abc] + 1:array:character <- [abc] ] ] diff --git a/070string.mu b/070string.mu index 640a85c8..91afb08e 100644 --- a/070string.mu +++ b/070string.mu @@ -308,7 +308,7 @@ scenario integer-to-decimal-digit-zero [ 2:array:character/raw <- copy *1:address:array:character/raw ] memory-should-contain [ - 2:string <- [0] + 2:array:character <- [0] ] ] @@ -318,7 +318,7 @@ scenario integer-to-decimal-digit-positive [ 2:array:character/raw <- copy *1:address:array:character/raw ] memory-should-contain [ - 2:string <- [234] + 2:array:character <- [234] ] ] @@ -381,7 +381,7 @@ scenario string-append-1 [ 4:array:character/raw <- copy *3:address:array:character/raw ] memory-should-contain [ - 4:string <- [hello, world!] + 4:array:character <- [hello, world!] ] ] @@ -392,7 +392,7 @@ scenario replace-character-in-string [ 2:array:character/raw <- copy *1:address:array:character/raw ] memory-should-contain [ - 2:string <- [azc] + 2:array:character <- [azc] ] ] @@ -417,7 +417,7 @@ scenario replace-character-at-start [ 2:array:character/raw <- copy *1:address:array:character/raw ] memory-should-contain [ - 2:string <- [zbc] + 2:array:character <- [zbc] ] ] @@ -428,7 +428,7 @@ scenario replace-character-at-end [ 2:array:character/raw <- copy *1:address:array:character/raw ] memory-should-contain [ - 2:string <- [abz] + 2:array:character <- [abz] ] ] @@ -439,7 +439,7 @@ scenario replace-character-missing [ 2:array:character/raw <- copy *1:address:array:character/raw ] memory-should-contain [ - 2:string <- [abc] + 2:array:character <- [abc] ] ] @@ -450,7 +450,7 @@ scenario replace-all-characters [ 2:array:character/raw <- copy *1:address:array:character/raw ] memory-should-contain [ - 2:string <- [bznznz] + 2:array:character <- [bznznz] ] ] @@ -539,7 +539,7 @@ scenario interpolate-works [ 4:array:character/raw <- copy *3:address:array:character/raw ] memory-should-contain [ - 4:string <- [abc def] + 4:array:character <- [abc def] ] ] @@ -551,7 +551,7 @@ scenario interpolate-at-start [ 4:array:character/raw <- copy *3:address:array:character/raw ] memory-should-contain [ - 4:string <- [abc, hello!] + 4:array:character <- [abc, hello!] 16 <- 0 # out of bounds ] ] @@ -564,7 +564,7 @@ scenario interpolate-at-end [ 4:array:character/raw <- copy *3:address:array:character/raw ] memory-should-contain [ - 4:string <- [hello, abc] + 4:array:character <- [hello, abc] ] ] @@ -687,7 +687,7 @@ scenario trim-unmodified [ 3:array:character <- copy *2:address:array:character ] memory-should-contain [ - 3:string <- [abc] + 3:array:character <- [abc] ] ] @@ -698,7 +698,7 @@ scenario trim-left [ 3:array:character <- copy *2:address:array:character ] memory-should-contain [ - 3:string <- [abc] + 3:array:character <- [abc] ] ] @@ -709,7 +709,7 @@ scenario trim-right [ 3:array:character <- copy *2:address:array:character ] memory-should-contain [ - 3:string <- [abc] + 3:array:character <- [abc] ] ] @@ -720,7 +720,7 @@ scenario trim-left-right [ 3:array:character <- copy *2:address:array:character ] memory-should-contain [ - 3:string <- [abc] + 3:array:character <- [abc] ] ] @@ -732,7 +732,7 @@ scenario trim-newline-tab [ 3:array:character <- copy *2:address:array:character ] memory-should-contain [ - 3:string <- [abc] + 3:array:character <- [abc] ] ] @@ -1094,8 +1094,8 @@ scenario string-split-1 [ ] memory-should-contain [ 3 <- 2 # length of result - 10:string <- [a] - 20:string <- [b] + 10:array:character <- [a] + 20:array:character <- [b] ] ] @@ -1113,9 +1113,9 @@ scenario string-split-2 [ ] memory-should-contain [ 3 <- 3 # length of result - 10:string <- [a] - 20:string <- [b] - 30:string <- [c] + 10:array:character <- [a] + 20:array:character <- [b] + 30:array:character <- [c] ] ] @@ -1129,7 +1129,7 @@ scenario string-split-missing [ ] memory-should-contain [ 3 <- 1 # length of result - 10:string <- [abc] + 10:array:character <- [abc] ] ] @@ -1160,10 +1160,10 @@ scenario string-split-empty-piece [ ] memory-should-contain [ 3 <- 4 # length of result - 10:string <- [a] - 20:string <- [b] - 30:string <- [] - 40:string <- [c] + 10:array:character <- [a] + 20:array:character <- [b] + 30:array:character <- [] + 40:array:character <- [c] ] ] @@ -1193,8 +1193,8 @@ scenario string-split-first [ 20:array:character <- copy *3:address:array:character ] memory-should-contain [ - 10:string <- [a] - 20:string <- [b] + 10:array:character <- [a] + 20:array:character <- [b] ] ] @@ -1230,7 +1230,7 @@ scenario string-copy-copies-substring [ 3:array:character <- copy *2:address:array:character ] memory-should-contain [ - 3:string <- [bc] + 3:array:character <- [bc] ] ] @@ -1241,7 +1241,7 @@ scenario string-copy-out-of-bounds [ 3:array:character <- copy *2:address:array:character ] memory-should-contain [ - 3:string <- [c] + 3:array:character <- [c] ] ] @@ -1252,7 +1252,7 @@ scenario string-copy-out-of-bounds-2 [ 3:array:character <- copy *2:address:array:character ] memory-should-contain [ - 3:string <- [] + 3:array:character <- [] ] ] diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu index 79da2409..d6e8b8a4 100644 --- a/edit/005-sandbox.mu +++ b/edit/005-sandbox.mu @@ -500,6 +500,6 @@ scenario editor-provides-edited-contents [ 4:array:character <- copy *3:address:array:character ] memory-should-contain [ - 4:string <- [abdefc] + 4:array:character <- [abdefc] ] ] diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu index 083dcc1c..63d86fb6 100644 --- a/sandbox/005-sandbox.mu +++ b/sandbox/005-sandbox.mu @@ -432,6 +432,6 @@ scenario editor-provides-edited-contents [ 4:array:character <- copy *3:address:array:character ] memory-should-contain [ - 4:string <- [abdefc] + 4:array:character <- [abdefc] ] ] |