read: Support R7RS '#true' and '#false' syntax for booleans.
* libguile/read.c (try_read_ci_chars): New static function.
(scm_read_boolean, scm_read_array): Use 'try_read_ci_chars'.
* doc/ref/api-data.texi (Booleans): Update docs.
* test-suite/tests/reader.test ("reading"): Add tests.
This commit is contained in:
parent
61d509194c
commit
7a329029cf
3 changed files with 55 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
;;;; reader.test --- Reader test. -*- coding: iso-8859-1; mode: scheme -*-
|
||||
;;;;
|
||||
;;;; Copyright (C) 1999, 2001, 2002, 2003, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
;;;; Copyright (C) 1999, 2001, 2002, 2003, 2007, 2008, 2009, 2010, 2011,
|
||||
;;;; 2014 Free Software Foundation, Inc.
|
||||
;;;; Jim Blandy <jimb@red-bean.com>
|
||||
;;;;
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
|
|
@ -73,6 +74,14 @@
|
|||
(not (equal? (imag-part (read-string "-nan.0-1i"))
|
||||
(imag-part (read-string "-nan.0+1i")))))
|
||||
|
||||
(pass-if-equal "#true"
|
||||
'(a #t b)
|
||||
(read-string "(a #true b)"))
|
||||
|
||||
(pass-if-equal "#false"
|
||||
'(a #f b)
|
||||
(read-string "(a #false b)"))
|
||||
|
||||
;; At one time the arg list for "Unknown # object: ~S" didn't make it out
|
||||
;; of read.c. Check that `format' can be applied to this error.
|
||||
(pass-if "error message on bad #"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue