This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Testsuite: new arraystore tests


These are some new reg tests for a compiler patch I'm about to submit. 
The failures are pretty obscure and existed before my patch, so they get 
xfails.

I'm checking these in.

regards

Bryce.

2002-02-20  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* libjava.lang/ArrayStore.java: New file.
	* libjava.lang/ArrayStore.out: New file.
	* libjava.lang/ArrayStore.xfail: New file. xfail-byte-output.
	* libjava.lang/ArrayStore2.java: New file.
	* libjava.lang/ArrayStore2.out: New file.
	* libjava.lang/ArrayStore2.xfail: New file. xfail-source-output.

Index: libjava.lang/ArrayStore.java
===================================================================
RCS file: ArrayStore.java
diff -N ArrayStore.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ ArrayStore.java	Tue Feb 19 20:10:09 2002
@@ -0,0 +1,52 @@
+public class ArrayStore
+{
+  public static void main(String[] args)
+  {
+    ArrayStore s = new ArrayStore();
+
+    /* Check that bounds check takes precedence over array store check. */
+    try 
+    {
+      s.a(new String[1]);
+    }
+    catch (Exception x)
+    {
+      System.out.println (x.getClass().getName());
+    }
+
+    try 
+    {
+      s.a(new String[2]);
+    }
+    catch (Exception x)
+    {
+      System.out.println (x.getClass().getName());
+    }
+
+    /* Check that += operator on String[] element works and throws bounds 
+       exception. */
+    try 
+    {
+      s.b(new String[1]);
+    }
+    catch (Exception x)
+    {
+      System.out.println (x.getClass().getName());
+    }
+
+    String[] sb = new String[2];
+    sb[1] = "foo";
+    s.b(sb);
+    System.out.println (sb[1]);
+  }
+
+  void a(Object[] oa)
+  {
+    oa[1] = new Integer(2);
+  }
+
+  void b(String[] sa)
+  {
+    sa[1] += "bar";
+  }
+}
Index: libjava.lang/ArrayStore.out
===================================================================
RCS file: ArrayStore.out
diff -N ArrayStore.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ ArrayStore.out	Tue Feb 19 20:10:09 2002
@@ -0,0 +1,4 @@
+java.lang.ArrayIndexOutOfBoundsException
+java.lang.ArrayStoreException
+java.lang.ArrayIndexOutOfBoundsException
+foobar
Index: libjava.lang/ArrayStore.xfail
===================================================================
RCS file: ArrayStore.xfail
diff -N ArrayStore.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ ArrayStore.xfail	Tue Feb 19 20:10:09 2002
@@ -0,0 +1 @@
+xfail-byte-output
Index: libjava.lang/ArrayStore2.java
===================================================================
RCS file: ArrayStore2.java
diff -N ArrayStore2.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ ArrayStore2.java	Tue Feb 19 20:10:09 2002
@@ -0,0 +1,31 @@
+public class ArrayStore2
+{
+  public static void main(String[] args)
+  {
+    new ArrayStore2().a(new Object[2], 3);
+  }
+
+  void a(Object[] oa, int i)
+  {
+    try
+    {
+      oa[index()] = obj();
+    }
+    catch (Exception x)
+    {
+      System.out.println (x.getClass().getName());
+    }
+  }
+
+  int index()
+  {
+    System.out.println ("index");
+    return 3;
+  }
+
+  Object obj()
+  {
+    System.out.println ("rhs");
+    return new Object();
+  }
+}
Index: libjava.lang/ArrayStore2.out
===================================================================
RCS file: ArrayStore2.out
diff -N ArrayStore2.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ ArrayStore2.out	Tue Feb 19 20:10:09 2002
@@ -0,0 +1,3 @@
+index
+rhs
+java.lang.ArrayIndexOutOfBoundsException
Index: libjava.lang/ArrayStore2.xfail
===================================================================
RCS file: ArrayStore2.xfail
diff -N ArrayStore2.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ ArrayStore2.xfail	Tue Feb 19 20:10:09 2002
@@ -0,0 +1 @@
+xfail-source-output

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]