Changeset 10284


Ignore:
Timestamp:
10/30/05 11:30:49 (16 years ago)
Author:
piso
Message:

Moved WITH-REGISTERED-EXCEPTION from test-utilities.lisp to java-tests.lisp.

Location:
trunk/j/src/org/armedbear/lisp/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/tests/java-tests.lisp

    r10283 r10284  
    22;;;
    33;;; Copyright (C) 2005 Peter Graves
    4 ;;; $Id: java-tests.lisp,v 1.12 2005-10-30 09:49:40 asimon Exp $
     4;;; $Id: java-tests.lisp,v 1.13 2005-10-30 11:30:23 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    5555
    5656#+abcl
     57(defmacro with-registered-exception (exception condition &body body)
     58  `(unwind-protect
     59       (progn
     60         (java:register-java-exception ,exception ,condition)
     61         ,@body)
     62    (java:unregister-java-exception ,exception)))
     63
     64#+abcl
    5765(deftest java-object.1
    5866  (class-name (find-class 'java-object nil))
     
    248256#+abcl
    249257(deftest unregister-java-exception.1
    250   (progn 
     258  (progn
    251259    (define-condition throwable (java-exception) ())
    252260    (register-java-exception "java.lang.Throwable" 'throwable)
    253261    (unregister-java-exception "java.lang.Throwable"))
    254262  t)
    255    
     263
    256264#+abcl
    257265(deftest unregister-java-exception.2
    258266  (unregister-java-exception "java.lang.Throwable")
    259267  nil)
    260    
     268
    261269
    262270
    263271#+abcl
    264272(deftest register-java-exception.1
    265   (progn 
    266     (define-condition throwable (java-exception) ())
    267     (with-registered-exception "java.lang.Throwable" 'throwable
    268       (signals-error 
     273  (progn
     274    (define-condition throwable (java-exception) ())
     275    (with-registered-exception "java.lang.Throwable" 'throwable
     276      (signals-error
    269277       (jnew (jconstructor "java.lang.String" "java.lang.String")
    270278             (make-immediate-object nil :ref))
     
    274282#+abcl
    275283(deftest register-java-exception.2
    276   (progn 
    277     (define-condition throwable (java-exception) ())
    278     (with-registered-exception "java.lang.Throwable" 'throwable
    279       (signals-error 
     284  (progn
     285    (define-condition throwable (java-exception) ())
     286    (with-registered-exception "java.lang.Throwable" 'throwable
     287      (signals-error
    280288       (jnew (jconstructor "java.lang.String" "java.lang.String") 42)
    281289       'throwable)))
     
    284292#+abcl
    285293(deftest register-java-exception.3
    286   (progn 
    287     (define-condition throwable (java-exception) ())
    288     (with-registered-exception "java.lang.Throwable" 'throwable
    289       (signals-error 
     294  (progn
     295    (define-condition throwable (java-exception) ())
     296    (with-registered-exception "java.lang.Throwable" 'throwable
     297      (signals-error
    290298       (jstatic (jmethod "java.lang.String" "valueOf" "int") "java.lang.String" "12")
    291299       'throwable)))
     
    294302#+abcl
    295303(deftest register-java-exception.4
    296   (progn 
     304  (progn
    297305    (define-condition throwable (java-exception) ())
    298306    (define-condition illegal-argument-exception (java-exception) ())
    299307    (with-registered-exception "java.lang.Throwable" 'throwable
    300308      (with-registered-exception "java.lang.IllegalArgumentException" 'illegal-argument-exception
    301         (signals-error 
     309        (signals-error
    302310         (jstatic (jmethod "java.lang.String" "valueOf" "int") "java.lang.String" "12")
    303311         'throwable))))
     
    306314#+abcl
    307315(deftest register-java-exception.5
    308   (progn 
     316  (progn
    309317    (define-condition throwable (java-exception) ())
    310318    (define-condition illegal-argument-exception (java-exception) ())
    311319    (with-registered-exception "java.lang.Throwable" 'throwable
    312320      (with-registered-exception "java.lang.IllegalArgumentException" 'illegal-argument-exception
    313         (signals-error 
     321        (signals-error
    314322         (jstatic (jmethod "java.lang.String" "valueOf" "int") "java.lang.String" "12")
    315323         'illegal-argument-exception))))
  • trunk/j/src/org/armedbear/lisp/tests/test-utilities.lisp

    r10282 r10284  
    22;;;
    33;;; Copyright (C) 2005 Peter Graves
    4 ;;; $Id: test-utilities.lisp,v 1.4 2005-10-30 09:47:33 asimon Exp $
     4;;; $Id: test-utilities.lisp,v 1.5 2005-10-30 11:30:49 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    3131       (error (c) (typep c ,error-name))
    3232       (:no-error (&rest ignored) (declare (ignore ignored)) nil))))
    33 
    34 (defmacro with-registered-exception (exception condition &body body)
    35   `(unwind-protect
    36        (progn
    37          (java:register-java-exception ,exception ,condition)
    38          ,@body)
    39     (java:unregister-java-exception ,exception)))
Note: See TracChangeset for help on using the changeset viewer.