hotspot/test/serviceability/ParserTest.java
changeset 13200 7b506e7b406e
parent 12262 fb3b9fede660
child 15793 4867678e3517
--- a/hotspot/test/serviceability/ParserTest.java	Wed Jul 04 15:55:45 2012 -0400
+++ b/hotspot/test/serviceability/ParserTest.java	Thu Jun 28 11:37:28 2012 +0200
@@ -20,6 +20,7 @@
         testNanoTime();
         testJLong();
         testBool();
+        testQuotes();
         testMemorySize();
     }
 
@@ -95,6 +96,33 @@
         parse(name, "false", "", args);
     }
 
+    public void testQuotes() throws Exception {
+        String name = "name";
+        DiagnosticCommand arg1 = new DiagnosticCommand(name,
+                "desc", DiagnosticArgumentType.STRING,
+                false, null);
+        DiagnosticCommand arg2 = new DiagnosticCommand("arg",
+                "desc", DiagnosticArgumentType.STRING,
+                false, null);
+        DiagnosticCommand[] args = {arg1, arg2};
+
+        // try with a quoted value
+        parse(name, "Recording 1", name + "=\"Recording 1\"", args);
+        // try with a quoted argument
+        parse(name, "myrec", "\"" + name + "\"" + "=myrec", args);
+        // try with both a quoted value and a quoted argument
+        parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\"", args);
+
+        // now the same thing but with other arguments after
+
+        // try with a quoted value
+        parse(name, "Recording 1", name + "=\"Recording 1\",arg=value", args);
+        // try with a quoted argument
+        parse(name, "myrec", "\"" + name + "\"" + "=myrec,arg=value", args);
+        // try with both a quoted value and a quoted argument
+        parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\",arg=value", args);
+    }
+
     public void testMemorySize() throws Exception {
         String name = "name";
         String defaultValue = "1024";