// Test handling of bogus options publicvoid testUnknown() {
startExCe(1, "Unknown option: u", "-unknown");
startExCe(1, "Unknown option: unknown", "--unknown");
}
// Test that input is read with "-" and there is no extra output. publicvoid testHypenFile() {
setIn("System.out.print(\"Hello\");\n");
startUo("Hello", "-");
setIn("System.out.print(\"Hello\");\n");
startUo("Hello", "-", "-");
String fn = writeToFile("System.out.print(\"===\");");
setIn("System.out.print(\"Hello\");\n");
startUo("===Hello===", fn, "-", fn); // check that errors go to standard error
setIn(") Foobar");
startExCe(0, s -> assertTrue(s.contains("illegal start of expression"), "cmderr: illegal start of expression"), "-");
}
// Test that non-existent load file sends output to stderr and does not startExCe (no welcome). publicvoid testUnknownLoadFile() {
startExCe(1, "File 'UNKNOWN' for 'jshell' is not found.", "UNKNOWN");
}
// Test bad usage of the --startup option publicvoid testStartup() {
String fn = writeToFile("");
startExCe(1, "Argument to startup missing.", "--startup");
startExCe(1, "Conflicting options: both --startup and --no-startup were used.", "--no-startup", "--startup", fn);
startExCe(1, "Conflicting options: both --startup and --no-startup were used.", "--startup", fn, "--no-startup");
startExCe(1, "Argument to startup missing.", "--no-startup", "--startup");
}
// Test an option that causes the back-end to fail is propagated publicvoid testStartupFailedOption() {
startExCe(1, s -> assertTrue(s.contains("Unrecognized option: -hoge-foo-bar"), "cmderr: " + s), "-R-hoge-foo-bar");
}
// Test the use of non-existant files with the --startup option publicvoid testStartupUnknown() {
startExCe(1, "File 'UNKNOWN' for '--startup' is not found.", "--startup", "UNKNOWN");
startExCe(1, "File 'UNKNOWN' for '--startup' is not found.", "--startup", "DEFAULT", "--startup", "UNKNOWN");
}
// Test bad usage of --class-path option publicvoid testClasspath() { for (String cp : new String[]{"--class-path"}) {
startExCe(1, "Only one --class-path option may be used.", cp, ".", "--class-path", ".");
startExCe(1, "Argument to class-path missing.", cp);
}
}
// Test bogus module on --add-modules option publicvoid testUnknownModule() {
startExCe(1, s -> assertTrue(s.contains("rror") && s.contains("unKnown"), "cmderr: " + s), "--add-modules", "unKnown");
}
// Test that muliple feedback options fail publicvoid testFeedbackOptionConflict() {
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "concise", "--feedback", "verbose");
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "concise", "-s");
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "verbose", "-q");
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "concise", "-v");
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-v", "--feedback", "concise");
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-q", "-v");
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-s", "-v");
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-v", "-q");
startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-q", "-s");
}
// Test bogus arguments to the --feedback option publicvoid testNegFeedbackOption() {
startExCe(1, "Argument to feedback missing.", "--feedback");
startExCe(1, "Does not match any current feedback mode: blorp -- --feedback blorp", "--feedback", "blorp");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.