1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-30 06:50:31 +02:00

Fix `reader.test'.

This is a followup to a4e4722944 ("need
read error for extra closing square brackets".)

* test-suite/tests/reader.test (exception:unexpected-rsqbracket): New
  variable.
  ("reading")["paren mismatch (2)"]: Change exception type to
  EXCEPTION:UNEXPECTED-RSQBRACKET.
  ["paren mismatch (3)", "paren mismatch (4)"]: New tests.
  ("mismatching parentheses")["closing square bracket following
  mismatched opening"]: New test.
This commit is contained in:
Ludovic Courtès 2010-11-07 23:31:53 +01:00
parent 253f26085e
commit 289c3a6112

View file

@ -26,6 +26,8 @@
(cons 'read-error "end of file$")) (cons 'read-error "end of file$"))
(define exception:unexpected-rparen (define exception:unexpected-rparen
(cons 'read-error "unexpected \")\"$")) (cons 'read-error "unexpected \")\"$"))
(define exception:unexpected-rsqbracket
(cons 'read-error "unexpected \"]\"$"))
(define exception:unterminated-block-comment (define exception:unterminated-block-comment
(cons 'read-error "unterminated `#. \\.\\.\\. .#' comment$")) (cons 'read-error "unterminated `#. \\.\\.\\. .#' comment$"))
(define exception:unknown-character-name (define exception:unknown-character-name
@ -135,12 +137,18 @@
(pass-if "square brackets are parens" (pass-if "square brackets are parens"
(equal? '() (read-string "[]"))) (equal? '() (read-string "[]")))
(pass-if-exception "paren mismatch" exception:unexpected-rparen (pass-if-exception "paren mismatch" exception:unexpected-rparen
(read-string "'[)")) (read-string "'[)"))
(pass-if-exception "paren mismatch (2)" exception:mismatched-paren (pass-if-exception "paren mismatch (2)" exception:unexpected-rsqbracket
(read-string "'(]"))) (read-string "'(]"))
(pass-if-exception "paren mismatch (3)" exception:mismatched-paren
(read-string "'(foo bar]"))
(pass-if-exception "paren mismatch (4)" exception:mismatched-paren
(read-string "'[foo bar)")))
@ -159,6 +167,9 @@
(pass-if-exception "closing parenthesis following mismatched opening" (pass-if-exception "closing parenthesis following mismatched opening"
exception:unexpected-rparen exception:unexpected-rparen
(read-string ")")) (read-string ")"))
(pass-if-exception "closing square bracket following mismatched opening"
exception:unexpected-rsqbracket
(read-string "]"))
(pass-if-exception "opening vector parenthesis" (pass-if-exception "opening vector parenthesis"
exception:eof exception:eof
(read-string "#(")) (read-string "#("))