ParserTest.java revision 4358
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test ParserTest
* @summary Test that the diagnostic command arguemnt parser works
* @library /testlibrary /testlibrary/whitebox
* @build ParserTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
*/
public class ParserTest {
public ParserTest() throws Exception {
testNanoTime();
testJLong();
testBool();
testQuotes();
}
new ParserTest();
}
public void testNanoTime() throws Exception {
false, "0");
//These should work
//Currently, only value 0 is allowed without unit
}
false, "0");
//shouldFail(name + "=12m", args); <-- should fail, doesn't
}
false, "false");
//Empty commandline to parse, tests default value
//of the parameter "name"
}
public void testQuotes() throws Exception {
false, null);
false, null);
// try with a quoted value
// try with a quoted argument
// try with both a quoted value and a quoted argument
// now the same thing but with other arguments after
// try with a quoted value
// try with a quoted argument
// try with both a quoted value and a quoted argument
}
public void testMemorySize() throws Exception {
false, defaultValue);
//shouldFail(name + "=7gg", args); <---- should fail, doesn't
//shouldFail(name + "=7t", args); <----- should fail, doesn't
}
//parseCommandLine will return an object array that looks like
//{<name of parsed object>, <of parsed object> ... }
return;
} else {
+ "! Expected: " + expectedValue);
}
}
}
}
try {
} catch (IllegalArgumentException e) {
//expected
}
}
}