[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-184-ga8215
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-184-ga8215ae |
Date: |
Mon, 02 Jul 2012 13:10:05 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=a8215aedad433a15abf87c2310a41c684dfcef97
The branch, stable-2.0 has been updated
via a8215aedad433a15abf87c2310a41c684dfcef97 (commit)
via bfdbea1f204f4c382a4b399469ca7dcc6cfacb28 (commit)
from 162d9025f8ab7a6abc24dfab735c432a155b7c69 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a8215aedad433a15abf87c2310a41c684dfcef97
Author: Ludovic Courtès <address@hidden>
Date: Sun Jul 1 17:32:03 2012 +0200
Have `procedure-arguments' always return the `allow-other-keys?' pair.
Fixes <http://bugs.gnu.org/10938>.
Based on a patch by Stefan Israelsson Tampe <address@hidden>.
* module/ice-9/session.scm (procedure-arguments): When the 'arglist
property is available, emit the `allow-other-keys?' pair. Use
`match-lambda'.
* test-suite/tests/session.test ("procedure-arguments")["aok? is
preserved"]: New test.
commit bfdbea1f204f4c382a4b399469ca7dcc6cfacb28
Author: Ludovic Courtès <address@hidden>
Date: Sun Jul 1 17:32:03 2012 +0200
Add tests for `procedure-arguments'.
* test-suite/tests/session.test ("procedure-arguments"): New test
prefix.
-----------------------------------------------------------------------
Summary of changes:
module/ice-9/session.scm | 18 +++++++++-----
test-suite/tests/session.test | 50 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 8 deletions(-)
diff --git a/module/ice-9/session.scm b/module/ice-9/session.scm
index fbb03d2..0eeed86 100644
--- a/module/ice-9/session.scm
+++ b/module/ice-9/session.scm
@@ -1,4 +1,5 @@
-;;;; Copyright (C) 1997, 2000, 2001, 2003, 2006, 2009, 2010, 2011 Free
Software Foundation, Inc.
+;;;; Copyright (C) 1997, 2000, 2001, 2003, 2006, 2009, 2010, 2011,
+;;;; 2012 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -20,6 +21,7 @@
#:use-module (ice-9 documentation)
#:use-module (ice-9 regex)
#:use-module (ice-9 rdelim)
+ #:use-module (ice-9 match)
#:export (help
add-value-help-handler! remove-value-help-handler!
add-name-help-handler! remove-name-help-handler!
@@ -504,14 +506,16 @@ It is an image under the mapping EXTRACT."
if the information cannot be obtained.
The alist keys that are currently defined are `required', `optional',
-`keyword', and `rest'."
+`keyword', `allow-other-keys?', and `rest'."
(cond
((procedure-property proc 'arglist)
- => (lambda (arglist)
- `((required . ,(car arglist))
- (optional . ,(cadr arglist))
- (keyword . ,(caddr arglist))
- (rest . ,(car (cddddr arglist))))))
+ => (match-lambda
+ ((req opt keyword aok? rest)
+ `((required . ,req)
+ (optional . ,opt)
+ (keyword . ,keyword)
+ (allow-other-keys? . ,aok?)
+ (rest . ,rest)))))
((procedure-source proc)
=> cadr)
(((@ (system vm program) program?) proc)
diff --git a/test-suite/tests/session.test b/test-suite/tests/session.test
index 1697471..242ecf9 100644
--- a/test-suite/tests/session.test
+++ b/test-suite/tests/session.test
@@ -1,7 +1,7 @@
;;;; session.test --- test suite for (ice-9 session) -*- scheme -*-
;;;; Jose Antonio Ortega Ruiz <address@hidden> -- August 2010
;;;;
-;;;; Copyright (C) 2010 Free Software Foundation, Inc.
+;;;; Copyright (C) 2010, 2012 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -20,6 +20,7 @@
(define-module (test-suite session)
#:use-module (test-suite lib)
+ #:use-module (system base compile)
#:use-module (ice-9 session))
(define (find-module mod)
@@ -51,3 +52,50 @@
(with-test-prefix "apropos-fold-exported"
(pass-if "a child of test-suite" (find-interface '(test-suite lib)))
(pass-if "a child of ice-9" (find-interface '(ice-9 session))))
+
+(with-test-prefix "procedure-arguments"
+
+ (define-syntax-rule (pass-if-valid-arguments name proc expected)
+ (pass-if name
+ (let ((args (procedure-arguments (compile 'proc #:to 'value))))
+ (or (equal? args 'expected)
+ (pk 'invalid-args args #f)))))
+
+ (pass-if-valid-arguments "lambda"
+ (lambda (a b c) #f)
+ ((required . (a b c)) (optional) (keyword)
+ (allow-other-keys? . #f) (rest . #f)))
+ (pass-if-valid-arguments "lambda with rest"
+ (lambda (a b . r) #f)
+ ((required . (a b)) (optional) (keyword)
+ (allow-other-keys? . #f) (rest . r)))
+ (pass-if-valid-arguments "lambda* with optionals"
+ (lambda* (a b #:optional (p 1) (q 2)) #f)
+ ((required . (a b)) (optional . (p q))
+ (keyword) (allow-other-keys? . #f) (rest . #f)))
+ (pass-if-valid-arguments "lambda* with keywords"
+ (lambda* (a b #:key (k 42) l) #f)
+ ((required . (a b)) (optional)
+ (keyword . ((#:k . 2) (#:l . 3))) (allow-other-keys? . #f)
+ (rest . #f)))
+ (pass-if-valid-arguments "lambda* with keywords and a-o-k"
+ (lambda* (a b #:key (k 42) #:allow-other-keys) #f)
+ ((required . (a b)) (optional)
+ (keyword . ((#:k . 2))) (allow-other-keys? . #t)
+ (rest . #f)))
+ (pass-if-valid-arguments "lambda* with optionals, keys, and rest"
+ (lambda* (a b #:optional o p #:key k l #:rest r) #f)
+ ((required . (a b)) (optional . (o p))
+ (keyword . ((#:k . 5) (#:l . 6))) (allow-other-keys? . #f)
+ (rest . k)))
+
+ (pass-if "aok? is preserved"
+ ;; See <http://bugs.gnu.org/10938>.
+ (let* ((proc (compile '(lambda (a b) #f) #:to 'value))
+ (args (procedure-arguments proc)))
+ (set-procedure-property! proc 'arglist (map cdr args))
+ (equal? args (procedure-arguments proc)))))
+
+;;; Local Variables:
+;;; eval: (put 'pass-if-valid-arguments 'scheme-indent-function 1)
+;;; End:
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-184-ga8215ae,
Ludovic Courtès <=