diff options
author | Andrew Haley <aph@redhat.com> | 2001-12-20 14:09:03 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2001-12-20 14:09:03 +0000 |
commit | 76eceb1ec3e8f329a52e588e406a03ddf51e2103 (patch) | |
tree | 9f14add8468ebf2577ac6640c7a51c3d6b951d33 /libjava/testsuite/libjava.lang/Array_3.java | |
parent | bcdd764b27668632a2b542a90a8ee07e61009220 (diff) | |
download | gcc-76eceb1ec3e8f329a52e588e406a03ddf51e2103.zip gcc-76eceb1ec3e8f329a52e588e406a03ddf51e2103.tar.gz gcc-76eceb1ec3e8f329a52e588e406a03ddf51e2103.tar.bz2 |
FileHandleGcTest.out: New file.
2001-12-20 Andrew Haley <aph@redhat.com>
* libjava.lang/FileHandleGcTest.out: New file.
* libjava.lang/FileHandleGcTest.java: New file.
* libjava.lang/Array_3.out: New file.
* libjava.lang/Array_3.java: New file.
From-SVN: r48201
Diffstat (limited to 'libjava/testsuite/libjava.lang/Array_3.java')
-rw-r--r-- | libjava/testsuite/libjava.lang/Array_3.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.lang/Array_3.java b/libjava/testsuite/libjava.lang/Array_3.java new file mode 100644 index 0000000..f8b7ded --- /dev/null +++ b/libjava/testsuite/libjava.lang/Array_3.java @@ -0,0 +1,59 @@ +// Test to make sure null arrays throw the right execption + +public class Array_3 +{ + static Object foo () + { + return null; + } + + static int[] bar () + { + return null; + } + + public static void main(String args[]) + { + boolean ok = false; + int nn = 0; + + try + { + int[] x = (int[])foo(); + nn = x.length; + } + catch (NullPointerException _) + { + ok = true; + } + if (!ok) + throw new RuntimeException("test failed"); + + ok = false; + try + { + int[] x = bar(); + nn = x.length; + } + catch (NullPointerException _) + { + ok = true; + } + if (!ok) + throw new RuntimeException("test failed"); + + ok = false; + try + { + int[] x = bar(); + nn = x[0]; + } + catch (NullPointerException _) + { + ok = true; + } + + if (!ok || nn != 0) + throw new RuntimeException("test failed"); + } +} |