2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-05 03:40:53 +00:00

Table-driven parsing for top-level arguments

This commit is contained in:
Jay Berkenbilt 2018-12-20 12:29:59 -05:00
parent 151206603b
commit 245723c570
3 changed files with 680 additions and 379 deletions

File diff suppressed because it is too large Load Diff

View File

@ -367,3 +367,5 @@ QPDFOutlineObjectHelper named dest 0
QPDFOutlineDocumentHelper name named dest 0
QPDFOutlineDocumentHelper string named dest 0
QPDFOutlineObjectHelper loop 0
qpdf required parameter 0
qpdf required choices 0

View File

@ -100,6 +100,27 @@ $td->runtest("UTF-16 encoding errors",
{$td->FILE => "unicode-errors.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
show_ntests();
# ----------
$td->notify("--- Argument Parsing ---");
$n_tests += 3;
$td->runtest("required argument",
{$td->COMMAND => "qpdf --password minimal.pdf"},
{$td->REGEXP => "must be given as --password=pass",
$td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES);
$td->runtest("required argument with choices",
{$td->COMMAND => "qpdf --decode-level minimal.pdf"},
{$td->REGEXP => "must be given as --decode-level=\\{.*all.*\\}",
$td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES);
$td->runtest("required argument with choices",
{$td->COMMAND => "qpdf --decode-level minimal.pdf"},
{$td->REGEXP => "must be given as --decode-level=\\{.*all.*\\}",
$td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES);
show_ntests();
# ----------
$td->notify("--- Form Tests ---");