This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: instanceof regression test
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: instanceof regression test
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 16 May 2000 14:03:03 -0600
- Reply-To: tromey at cygnus dot com
I'm checking this in. It adds a simple regression test for the
`instanceof' operator. (Nothing is wrong with instanceof, but this
test is useful to test some changes I'm playing with.)
2000-05-16 Tom Tromey <tromey@cygnus.com>
* libjava.lang/instance.out: New file.
* libjava.lang/instance.java: New file.
Tom
Index: libjava.lang//instance.java
===================================================================
RCS file: instance.java
diff -N instance.java
--- /dev/null Tue May 5 13:32:27 1998
+++ instance.java Tue May 16 12:56:08 2000
@@ -0,0 +1,48 @@
+// instance.java -- test the `instanceof' operator.
+
+import java.util.EventListener;
+
+public class instance implements EventListener
+{
+ public static void main (String[] args)
+ {
+ Object x1 = new instance ();
+ EventListener x2 = new instance ();
+ IllegalArgumentException iae
+ = new IllegalArgumentException ("any random class");
+ String x3 = "zardoz";
+ Object x4 = "zardoz";
+
+ // Test simple object stuff
+ System.out.println (x1 instanceof Object);
+ System.out.println (x1 instanceof IllegalArgumentException);
+ System.out.println (x1 instanceof EventListener);
+ System.out.println (x1 instanceof String);
+ System.out.println ("=");
+
+ // Test with value which is an interface.
+ System.out.println (x2 instanceof Object);
+ System.out.println (x2 instanceof IllegalArgumentException);
+ System.out.println (x2 instanceof EventListener);
+ System.out.println ("=");
+
+ // Test with value which is a final class.
+ System.out.println (x3 instanceof Object);
+ System.out.println (x3 instanceof String);
+ System.out.println ("=");
+
+ // Test with value which is a random class.
+ System.out.println (iae instanceof Object);
+ System.out.println (iae instanceof IllegalArgumentException);
+ System.out.println (iae instanceof EventListener);
+ System.out.println ("=");
+
+ // Test with value which is a final class, but not known
+ // statically.
+ System.out.println (x4 instanceof Object);
+ System.out.println (x4 instanceof IllegalArgumentException);
+ System.out.println (x4 instanceof EventListener);
+ System.out.println (x4 instanceof String);
+ System.out.println (x4 instanceof int[]);
+ }
+}
Index: libjava.lang//instance.out
===================================================================
RCS file: instance.out
diff -N instance.out
--- /dev/null Tue May 5 13:32:27 1998
+++ instance.out Tue May 16 12:56:08 2000
@@ -0,0 +1,21 @@
+true
+false
+true
+false
+=
+true
+false
+true
+=
+true
+true
+=
+true
+true
+false
+=
+true
+false
+false
+true
+false