Changeset 10283


Ignore:
Timestamp:
10/30/05 09:49:40 (16 years ago)
Author:
asimon
Message:

Tests for (un)registering Java exceptions.

File:
1 edited

Legend:

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

    r10267 r10283  
    22;;;
    33;;; Copyright (C) 2005 Peter Graves
    4 ;;; $Id: java-tests.lisp,v 1.11 2005-10-28 17:14:34 piso Exp $
     4;;; $Id: java-tests.lisp,v 1.12 2005-10-30 09:49:40 asimon Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    245245  t)
    246246
     247
     248#+abcl
     249(deftest unregister-java-exception.1
     250  (progn
     251    (define-condition throwable (java-exception) ())
     252    (register-java-exception "java.lang.Throwable" 'throwable)
     253    (unregister-java-exception "java.lang.Throwable"))
     254  t)
     255   
     256#+abcl
     257(deftest unregister-java-exception.2
     258  (unregister-java-exception "java.lang.Throwable")
     259  nil)
     260   
     261
     262
     263#+abcl
     264(deftest register-java-exception.1
     265  (progn
     266    (define-condition throwable (java-exception) ())
     267    (with-registered-exception "java.lang.Throwable" 'throwable
     268      (signals-error
     269       (jnew (jconstructor "java.lang.String" "java.lang.String")
     270             (make-immediate-object nil :ref))
     271       'throwable)))
     272  t)
     273
     274#+abcl
     275(deftest register-java-exception.2
     276  (progn
     277    (define-condition throwable (java-exception) ())
     278    (with-registered-exception "java.lang.Throwable" 'throwable
     279      (signals-error
     280       (jnew (jconstructor "java.lang.String" "java.lang.String") 42)
     281       'throwable)))
     282  t)
     283
     284#+abcl
     285(deftest register-java-exception.3
     286  (progn
     287    (define-condition throwable (java-exception) ())
     288    (with-registered-exception "java.lang.Throwable" 'throwable
     289      (signals-error
     290       (jstatic (jmethod "java.lang.String" "valueOf" "int") "java.lang.String" "12")
     291       'throwable)))
     292  t)
     293
     294#+abcl
     295(deftest register-java-exception.4
     296  (progn
     297    (define-condition throwable (java-exception) ())
     298    (define-condition illegal-argument-exception (java-exception) ())
     299    (with-registered-exception "java.lang.Throwable" 'throwable
     300      (with-registered-exception "java.lang.IllegalArgumentException" 'illegal-argument-exception
     301        (signals-error
     302         (jstatic (jmethod "java.lang.String" "valueOf" "int") "java.lang.String" "12")
     303         'throwable))))
     304  nil)
     305
     306#+abcl
     307(deftest register-java-exception.5
     308  (progn
     309    (define-condition throwable (java-exception) ())
     310    (define-condition illegal-argument-exception (java-exception) ())
     311    (with-registered-exception "java.lang.Throwable" 'throwable
     312      (with-registered-exception "java.lang.IllegalArgumentException" 'illegal-argument-exception
     313        (signals-error
     314         (jstatic (jmethod "java.lang.String" "valueOf" "int") "java.lang.String" "12")
     315         'illegal-argument-exception))))
     316  t)
     317
    247318(do-tests)
    248319
Note: See TracChangeset for help on using the changeset viewer.