From e51a511ccee3f3c0120807321bcc160fcaa664be Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 23 Sep 2011 14:16:35 -0700 Subject: Exception support for CanPutArrayElementFromCode. Also a unit test. Change-Id: I6fb4b4180d36ea2d8447a9b4d5cf28cf410960cd --- test/IntMath/IntMath.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test/IntMath/IntMath.java') diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java index e5fa806ca4..b1b7312fb2 100644 --- a/test/IntMath/IntMath.java +++ b/test/IntMath/IntMath.java @@ -786,6 +786,34 @@ class IntMath extends IntMathBase { return res; } + static void throwArrayStoreException(Object[] array, Object element) { + array[0] = element; + } + + static int testArrayStoreException() { + int res=0; + Object[] array = new Number[2]; + try { + throwArrayStoreException(array, null); + res += 1; + } catch(ArrayStoreException e) { + res += 2; + } + try { + throwArrayStoreException(array, Integer.valueOf(1)); + res += 10; + } catch(ArrayStoreException e) { + res += 20; + } + try { + throwArrayStoreException(array, "hello MTV-44"); + res += 100; + } catch(ArrayStoreException e) { + res += 200; + } + return res; + } + static long recursion_count_; static void throwStackOverflow(long l) { recursion_count_++; @@ -966,6 +994,14 @@ class IntMath extends IntMathBase { failure = true; } + res = testArrayStoreException(); + if (res == 211) { + System.out.println("testArrayStore PASSED"); + } else { + System.out.println("testArrayStore FAILED: " + res); + failure = true; + } + lres= testStackOverflow(); if (lres == 0) { System.out.println("testStackOverflow PASSED"); -- cgit v1.2.3-59-g8ed1b