Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/code/format.lisp
    ... ... @@ -399,7 +399,8 @@
    399 399
     	  (form new-directives)
    
    400 400
     	  (expand-directive (car remaining-directives)
    
    401 401
     			    (cdr remaining-directives))
    
    402
    -	(push form results)
    
    402
    +	(when form
    
    403
    +          (push form results))
    
    403 404
     	(setf remaining-directives new-directives)))
    
    404 405
         (reverse results)))
    
    405 406
     
    

  • tests/printer.lisp
    ... ... @@ -113,3 +113,16 @@
    113 113
     
    
    114 114
     (define-test sub-output-integer.1
    
    115 115
         (assert-prints "-536870912" (princ most-negative-fixnum)))
    
    116
    +
    
    117
    +;;; Simple LOOP requires only compound forms. Hence NIL is not
    
    118
    +;;; permitted. Some FORMAT directives (like newline) return NIL
    
    119
    +;;; as the form when they have nothing to add to the body.
    
    120
    +;;; Normally this is fine since BLOCK accepts NIL as a form. On
    
    121
    +;;; the other hand, when the newline directive is inside of an
    
    122
    +;;; iteration directive this will produce something like
    
    123
    +;;; (LOOP (fu) nil (bar)) which is not acceptable. To verify
    
    124
    +;;; that this is not happening we make sure we are not getting
    
    125
    +;;; (BLOCK NIL NIL) since this is easier to test for.
    
    126
    +(define-test format-no-nil-form.1
    
    127
    +    (assert-equal '(block nil) (third (second (macroexpand-1 '(formatter "~
    
    128
    +"))))))