test/serviceability/ParserTest.java

changeset 3905
5a1f452f8f90
parent 3681
51612f0c0a79
child 4637
1b0dc9f87e75
     1.1 --- a/test/serviceability/ParserTest.java	Wed Jul 04 15:55:45 2012 -0400
     1.2 +++ b/test/serviceability/ParserTest.java	Thu Jun 28 11:37:28 2012 +0200
     1.3 @@ -20,6 +20,7 @@
     1.4          testNanoTime();
     1.5          testJLong();
     1.6          testBool();
     1.7 +        testQuotes();
     1.8          testMemorySize();
     1.9      }
    1.10  
    1.11 @@ -95,6 +96,33 @@
    1.12          parse(name, "false", "", args);
    1.13      }
    1.14  
    1.15 +    public void testQuotes() throws Exception {
    1.16 +        String name = "name";
    1.17 +        DiagnosticCommand arg1 = new DiagnosticCommand(name,
    1.18 +                "desc", DiagnosticArgumentType.STRING,
    1.19 +                false, null);
    1.20 +        DiagnosticCommand arg2 = new DiagnosticCommand("arg",
    1.21 +                "desc", DiagnosticArgumentType.STRING,
    1.22 +                false, null);
    1.23 +        DiagnosticCommand[] args = {arg1, arg2};
    1.24 +
    1.25 +        // try with a quoted value
    1.26 +        parse(name, "Recording 1", name + "=\"Recording 1\"", args);
    1.27 +        // try with a quoted argument
    1.28 +        parse(name, "myrec", "\"" + name + "\"" + "=myrec", args);
    1.29 +        // try with both a quoted value and a quoted argument
    1.30 +        parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\"", args);
    1.31 +
    1.32 +        // now the same thing but with other arguments after
    1.33 +
    1.34 +        // try with a quoted value
    1.35 +        parse(name, "Recording 1", name + "=\"Recording 1\",arg=value", args);
    1.36 +        // try with a quoted argument
    1.37 +        parse(name, "myrec", "\"" + name + "\"" + "=myrec,arg=value", args);
    1.38 +        // try with both a quoted value and a quoted argument
    1.39 +        parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\",arg=value", args);
    1.40 +    }
    1.41 +
    1.42      public void testMemorySize() throws Exception {
    1.43          String name = "name";
    1.44          String defaultValue = "1024";

mercurial