source: trunk/j/src/org/armedbear/lisp/tests/java-tests.lisp @ 10213

Last change on this file since 10213 was 10213, checked in by piso, 16 years ago

Work in progress.

File size: 2.7 KB
Line 
1;;; java-tests.lisp
2;;;
3;;; Copyright (C) 2005 Peter Graves
4;;; $Id: java-tests.lisp,v 1.3 2005-10-24 12:47:35 piso Exp $
5;;;
6;;; This program is free software; you can redistribute it and/or
7;;; modify it under the terms of the GNU General Public License
8;;; as published by the Free Software Foundation; either version 2
9;;; of the License, or (at your option) any later version.
10;;;
11;;; This program is distributed in the hope that it will be useful,
12;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with this program; if not, write to the Free Software
18;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20(unless (member "RT" *modules* :test #'string=)
21  (load "rt-package.lisp")
22  (load #+abcl (compile-file-if-needed "rt.lisp")
23        ;; Force compilation to avoid fasl name conflict between SBCL and
24        ;; Allegro.
25        #-abcl (compile-file "rt.lisp"))
26  (provide "RT"))
27
28;; FIXME
29(load "test-utilities.lisp")
30
31(regression-test:rem-all-tests)
32
33(setf regression-test:*expected-failures* nil)
34
35(unless (find-package '#:test)
36  (defpackage #:test (:use #:cl #:regression-test)))
37
38(in-package #:test)
39
40#+abcl
41(use-package '#:java)
42
43#+allegro
44(require :jlinker)
45#+allegro
46(use-package '#:javatools.jlinker)
47#+allegro
48(use-package '#:javatools.jlinker '#:cl-user) ;; For convenience only.
49#+(and allegro mswindows)
50(use-package '#:javatools.jlinker '#:cg-user) ;; For convenience only.
51#+allegro
52(load "jl-config.cl")
53#+allegro
54(or (jlinker-query) (jlinker-init))
55
56#+abcl
57(deftest java-object.1
58  (class-name (find-class 'java-object nil))
59  java-object)
60
61(deftest jclass-name.1
62  (jclass-name (jclass "java.lang.Object"))
63  "java.lang.Object")
64
65(deftest jclass-name.2
66  (jclass-name (jclass "java.lang.Object") "java.lang.Object")
67  t
68  "java.lang.Object")
69
70(deftest jclass-name.3
71  (jclass-name (jclass "java.lang.Object") "foo")
72  nil
73  "java.lang.Object")
74
75(deftest jcall.1
76  (let ((method (jmethod "java.lang.String" "length")))
77    (jcall method "test"))
78  4)
79
80(deftest jcall.2
81  (jcall "length" "test")
82  4)
83
84(deftest jcall.3
85  (let ((method (jmethod "java.lang.String" "regionMatches" 4)))
86    (jcall method "test" 0 "this is a test" 10 4))
87  t)
88
89(deftest jcall.4
90  (let ((method (jmethod "java.lang.String" "regionMatches" 5)))
91    (jcall method "test" (make-immediate-object nil :boolean) 0 "this is a test" 10 4))
92  t)
93
94(deftest jfield.1
95  (type-of (jfield "java.lang.Integer" "TYPE"))
96  #+abcl    java-object
97  #+allegro tran-struct)
98
99(do-tests)
100
101;;#+allegro
102;;(jlinker-end)
Note: See TracBrowser for help on using the repository browser.