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

Fix SRFI-37 `args-fold' with short option names of argument-less options.

This commit is contained in:
Ludovic Courtès 2008-03-12 16:57:36 +00:00
parent 9f27d63612
commit c89ae78ba6
5 changed files with 34 additions and 4 deletions

View file

@ -1,6 +1,6 @@
;;;; srfi-37.test --- Test suite for SRFI 37 -*- scheme -*-
;;;;
;;;; Copyright (C) 2007 Free Software Foundation, Inc.
;;;; Copyright (C) 2007, 2008 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@ -94,4 +94,16 @@
(lambda (opt name arg k) #f)
'()))))
(pass-if "short options without arguments"
;; In Guile 1.8.4 and earlier, using short names of argument-less options
;; would lead to a stack overflow.
(let ((arg-proc (lambda (opt name arg k)
(acons name arg k))))
(equal? '((#\x . #f))
(args-fold '("-x")
(list (option '(#\x) #f #f arg-proc))
(lambda (opt name arg k) #f)
(lambda (opt name arg k) #f)
'()))))
)