Raymond Toy pushed to branch issue-291-pprint-handler-case at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • tests/pprint.lisp
    ... ... @@ -27,26 +27,97 @@
    27 27
                      (print "Hello"))
    
    28 28
                    s))))
    
    29 29
     
    
    30
    -(define-test pprint.handler-case  
    
    30
    +(define-test pprint.handler-case.1
    
    31 31
         (:tag :issues)
    
    32
    +  ;; Just an expression
    
    32 33
       (assert-equal 
    
    33
    -"
    
    34
    +   "
    
    35
    +(HANDLER-CASE (SIGNAL CONDITION))"
    
    36
    +    (with-output-to-string (s)
    
    37
    +      (pprint '(handler-case (signal condition))
    
    38
    +              s))))
    
    39
    +
    
    40
    +(define-test pprint.handler-case.2
    
    41
    +    (:tag :issues)
    
    42
    +  ;; One error clause
    
    43
    +  (assert-equal 
    
    44
    +   "
    
    34 45
     (HANDLER-CASE (SIGNAL CONDITION)
    
    35 46
       (WARNING NIL
    
    36
    -    \"Lots of smoke, but no fire.\")
    
    37
    -  ((OR ARITHMETIC-ERROR CONTROL-ERROR CELL-ERROR STREAM-ERROR) (CONDITION)
    
    38
    -    (FORMAT NIL \"~S looks especially bad.\" CONDITION))
    
    39
    -  (SERIOUS-CONDITION (CONDITION)
    
    40
    -    (FORMAT NIL \"~S looks serious.\" CONDITION))
    
    41
    -  (CONDITION NIL
    
    42
    -    \"Hardly worth mentioning.\"))"
    
    47
    +    \"Lots of smoke, but no fire.\"))"
    
    43 48
         (with-output-to-string (s)
    
    44 49
           (pprint '(handler-case (signal condition)
    
    45
    -                (warning () "Lots of smoke, but no fire.")
    
    46
    -                ((or arithmetic-error control-error cell-error stream-error)
    
    47
    -                 (condition)
    
    48
    -                 (format nil "~S looks especially bad." condition))
    
    49
    -                (serious-condition (condition)
    
    50
    -                 (format nil "~S looks serious." condition))
    
    51
    -                (condition () "Hardly worth mentioning."))
    
    50
    +                (warning () "Lots of smoke, but no fire."))
    
    52 51
                   s))))
    
    52
    +
    
    53
    +(define-test pprint.handler-case.3
    
    54
    +    (:tag :issues)
    
    55
    +  ;; More than one error clause
    
    56
    +  (assert-equal 
    
    57
    +   "
    
    58
    +(HANDLER-CASE (SIGNAL CONDITION)
    
    59
    +  (WARNING NIL
    
    60
    +    \"Lots of smoke, but no fire.\")
    
    61
    +  ((OR ARITHMETIC-ERROR CONTROL-ERROR CELL-ERROR STREAM-ERROR) (CONDITION)
    
    62
    +    (FORMAT NIL \"~S looks especially bad.\" CONDITION)))"
    
    63
    +   (with-output-to-string (s)
    
    64
    +     (pprint '(handler-case (signal condition)
    
    65
    +               (warning () "Lots of smoke, but no fire.")
    
    66
    +               ((or arithmetic-error control-error cell-error stream-error)
    
    67
    +                (condition)
    
    68
    +                (format nil "~S looks especially bad." condition)))
    
    69
    +             s))))
    
    70
    +
    
    71
    +(define-test pprint.handler-case.4
    
    72
    +    (:tag :issues)
    
    73
    +  ;; An expression and a no-error clause
    
    74
    +  (assert-equal 
    
    75
    +   "
    
    76
    +(HANDLER-CASE (SIGNAL CONDITION)
    
    77
    +  (:NO-ERROR NIL
    
    78
    +    (FORMAT NIL \"Nothing bad happened.\")))"
    
    79
    +   (with-output-to-string (s)
    
    80
    +     (pprint '(handler-case (signal condition)
    
    81
    +               (:no-error ()
    
    82
    +                (format nil "Nothing bad happened.")))
    
    83
    +             s))))
    
    84
    +
    
    85
    +
    
    86
    +(define-test pprint.handler-case.5
    
    87
    +    (:tag :issues)
    
    88
    +  ;; One error clause and a no-error clause
    
    89
    +  (assert-equal 
    
    90
    +   "
    
    91
    +(HANDLER-CASE (SIGNAL CONDITION)
    
    92
    +  (WARNING NIL
    
    93
    +    \"Lots of smoke, but no fire.\")
    
    94
    +  (:NO-ERROR NIL
    
    95
    +    (FORMAT NIL \"Nothing bad happened.\")))"
    
    96
    +   (with-output-to-string (s)
    
    97
    +     (pprint '(handler-case (signal condition)
    
    98
    +               (warning () "Lots of smoke, but no fire.")
    
    99
    +               (:no-error ()
    
    100
    +                (format nil "Nothing bad happened.")))
    
    101
    +             s))))
    
    102
    +
    
    103
    +(define-test pprint.handler-case.6
    
    104
    +    (:tag :issues)
    
    105
    +  ;; More than one error clause and a no-error clause
    
    106
    +  (assert-equal 
    
    107
    +   "
    
    108
    +(HANDLER-CASE (SIGNAL CONDITION)
    
    109
    +  (WARNING NIL
    
    110
    +    \"Lots of smoke, but no fire.\")
    
    111
    +  ((OR ARITHMETIC-ERROR CONTROL-ERROR CELL-ERROR STREAM-ERROR) (CONDITION)
    
    112
    +    (FORMAT NIL \"~S looks especially bad.\" CONDITION))
    
    113
    +  (:NO-ERROR NIL
    
    114
    +    (FORMAT NIL \"Nothing bad happened.\")))"
    
    115
    +   (with-output-to-string (s)
    
    116
    +     (pprint '(handler-case (signal condition)
    
    117
    +               (warning () "Lots of smoke, but no fire.")
    
    118
    +               ((or arithmetic-error control-error cell-error stream-error)
    
    119
    +                (condition)
    
    120
    +                (format nil "~S looks especially bad." condition))
    
    121
    +               (:no-error ()
    
    122
    +                (format nil "Nothing bad happened.")))
    
    123
    +             s))))