changeset 28:5958143570a7

meth: more sun.dyn.util.BytecodeName test cases
author jrose
date Fri, 07 Aug 2009 18:13:21 -0700
parents 7b03cdfd6265
children 7c3f96e3b7f0
files netbeans/meth/test/sun/dyn/util/BytecodeNameTest.java
diffstat 1 files changed, 28 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/netbeans/meth/test/sun/dyn/util/BytecodeNameTest.java	Fri Aug 07 17:10:42 2009 -0700
+++ b/netbeans/meth/test/sun/dyn/util/BytecodeNameTest.java	Fri Aug 07 18:13:21 2009 -0700
@@ -167,13 +167,36 @@
         assertEquals(expResult, result);
     }
 
-    @Test // @Lame
+    String[][] DISPLAY_SAMPLES = {
+        {"foo", "foo"},
+        {"", "" }, // not "''"
+        {"\\=", "''" }, // not ""
+        {"\\=,\\%,\\=", "',$,\\\\='" },
+        {"\\=.\\%.\\=", "''.'$'.''" },
+        {"123", "'123'"},
+        {"'", "'\\''"},
+        {"\\", "'\\\\'"},
+        {"java.lang", "java.lang"},
+        {"java.123", "java.'123'"},
+        {"123.lang", "'123'.lang"},
+        {"\\|", "'/'"},
+        {"foo:bar", "foo:bar"},
+        {"\\=foo\\!bar", "'foo:bar'"},
+        {"foo$bar", "foo$bar"},
+        {"\\=foo\\%bar", "'foo$bar'"},
+    };
+
+    @Test
     public void testToDisplayName() {
         System.out.println("toDisplayName");
-        String s = "foo";
-        String expResult = "foo";
-        String result = BytecodeName.toDisplayName(s);
-        assertEquals(expResult, result);
+        for (String[] sample : DISPLAY_SAMPLES) {
+            String s = sample[0];
+            String expResult = sample[1];
+            String result = BytecodeName.toDisplayName(s);
+            if (!result.equals(expResult))
+                System.out.println(s+" => "+result+" != "+expResult);
+            assertEquals(expResult, result);
+        }
     }
 
     @Test