< prev index next >

test/jdk/java/util/Formatter/BasicShortObject.java

Print this page

        

@@ -50,10 +50,13 @@
         ck(fs, exp, f.toString());
 
         f = new Formatter(new StringBuilder(), Locale.US);
         f.format("foo " + fs + " bar", args);
         ck(fs, "foo " + exp + " bar", f.toString());
+
+        JavacIntrinsicsSupport.formatAndCheck(fs, exp, Locale.US, args);
+        JavacIntrinsicsSupport.formatAndCheck("foo " + fs + " bar", "foo " + exp + " bar", Locale.US, args);
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
     {
         Formatter f = new Formatter(new StringBuilder(), l);

@@ -61,10 +64,13 @@
         ck(fs, exp, f.toString());
 
         f = new Formatter(new StringBuilder(), l);
         f.format("foo " + fs + " bar", args);
         ck(fs, "foo " + exp + " bar", f.toString());
+
+        JavacIntrinsicsSupport.formatAndCheck(fs, exp, l, args);
+        JavacIntrinsicsSupport.formatAndCheck("foo " + fs + " bar", "foo " + exp + " bar", l, args);
     }
 
     private static void test(String fs, Object ... args) {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);

@@ -122,10 +128,12 @@
         }
         if (!caught)
             fail(fs, ex);
         else
             pass();
+
+        tryCatchIntrinsic(fs, ex);
     }
 
     private static void tryCatch(String fs, Class<?> ex, Object ... args) {
         boolean caught = false;
         try {

@@ -133,10 +141,40 @@
         } catch (Throwable x) {
             if (ex.isAssignableFrom(x.getClass()))
                 caught = true;
         }
         if (!caught)
+            fail(fs, ex);
+        else
+            pass();
+
+        tryCatchIntrinsic(fs, ex, args);
+    }
+
+    private static void tryCatchIntrinsic(String fs, Class<?> ex) {
+        boolean caught = false;
+        try {
+            JavacIntrinsicsSupport.formatAndCheck(fs, "fail", Locale.US, "fail");
+        } catch (Throwable x) {
+            if (ex.isAssignableFrom(x.getClass()))
+                caught = true;
+        }
+        if (!caught)
+            fail(fs, ex);
+        else
+            pass();
+    }
+
+    private static void tryCatchIntrinsic(String fs, Class<?> ex, Object ... args) {
+        boolean caught = false;
+        try {
+            JavacIntrinsicsSupport.formatAndCheck(fs, "fail", Locale.US, args);
+        } catch (Throwable x) {
+            if (ex.isAssignableFrom(x.getClass()))
+                caught = true;
+        }
+        if (!caught)
             fail(fs, ex);
         else
             pass();
     }
 
< prev index next >