Manual tests for parse errors because scenarios can't handle assertion
failures yet.
This commit is contained in:
Kartik K. Agaram 2016-07-23 14:17:35 -07:00
parent e7b152ceb2
commit a62cf4c3e3
2 changed files with 37 additions and 10 deletions

View File

@ -1,9 +1,10 @@
1. screen background color
2. has-more-events?
3. hide/show screen
4. more touch event types
5. sandbox isolation
6. read/write files
1. assertion failures or errors inside scenarios
2. screen background color
3. has-more-events?
4. hide/show screen
5. more touch event types
6. sandbox isolation
7. read/write files
termbox issues are implementation-specific and not worth testing:
whether we clear junk from other processes

View File

@ -188,8 +188,9 @@ def parse in:address:stream -> out:address:cell, in:address:stream [
out <- new cell:type # start out with nil
# read in first element of pair
{
done?:boolean <- end-of-stream? in
break-if done?
end?:boolean <- end-of-stream? in
not-end?:boolean <- not end?
assert not-end?, [unbalanced '(' in expression]
c <- peek in
close-paren?:boolean <- equal c, 41/close-paren
break-if close-paren?
@ -199,8 +200,9 @@ def parse in:address:stream -> out:address:cell, in:address:stream [
# read in any remaining elements
curr:address:cell <- copy out
{
done?:boolean <- end-of-stream? in
break-if done?
end?:boolean <- end-of-stream? in
not-end?:boolean <- not end?
assert not-end?, [unbalanced '(' in expression]
c <- peek in
close-paren?:boolean <- equal c, 41/close-paren
break-if close-paren?
@ -296,3 +298,27 @@ scenario parse-list-of-more-than-two-atoms [
40:array:character <- [ghi] # result.rest.rest
]
]
# todo: uncomment these tests after we figure out how to continue tests after
# assertion failures
#? scenario parse-error [
#? local-scope
#? s:address:array:character <- new [(]
#? #? hide-errors
#? x:address:cell <- parse s
#? #? show-errors
#? trace-should-contain [
#? error: unbalanced '(' in expression
#? ]
#? ]
#?
#? scenario parse-error-after-element [
#? local-scope
#? s:address:array:character <- new [(abc]
#? #? hide-errors
#? x:address:cell <- parse s
#? #? show-errors
#? trace-should-contain [
#? error: unbalanced '(' in expression
#? ]
#? ]