aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qtest
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2017-08-06 14:42:01 +0200
committerJay Berkenbilt <ejb@ql.org>2017-08-11 03:30:32 +0200
commit296b679d6e3217cc112b7ed19b363b82356615ef (patch)
tree7cb9b3aa95c00da45cf1a7cf67a020c1ee54a6c9 /libtests/qtest
parentef8ae5449dc30782451beba64fdd0af86e1cb931 (diff)
downloadqpdf-296b679d6e3217cc112b7ed19b363b82356615ef.tar.zst
Implement findFirst and findLast in InputSource
Preparing to refactor some pattern searching code to use these instead of their own memchr loops. This should simplify the code that replaces PCRE.
Diffstat (limited to 'libtests/qtest')
-rw-r--r--libtests/qtest/input_source.test26
-rw-r--r--libtests/qtest/input_source/input_source.out14
2 files changed, 40 insertions, 0 deletions
diff --git a/libtests/qtest/input_source.test b/libtests/qtest/input_source.test
new file mode 100644
index 00000000..89a1c21a
--- /dev/null
+++ b/libtests/qtest/input_source.test
@@ -0,0 +1,26 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+chdir("input_source") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+my $td = new TestDriver('InputSource');
+
+cleanup();
+
+$td->runtest("input source tests",
+ {$td->COMMAND => "input_source"},
+ {$td->FILE => "input_source.out",
+ $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+
+cleanup();
+
+$td->report(1);
+
+sub cleanup
+{
+}
diff --git a/libtests/qtest/input_source/input_source.out b/libtests/qtest/input_source/input_source.out
new file mode 100644
index 00000000..6af379c6
--- /dev/null
+++ b/libtests/qtest/input_source/input_source.out
@@ -0,0 +1,14 @@
+find potato salad: PASS
+barely find potato salad: PASS
+barely find potato salad: PASS
+potato salad is too late: PASS
+potato salad is too late: PASS
+potato salad not found: PASS
+potato salad not found: PASS
+potato salad at EOF: PASS
+findFirst found first: PASS
+findLast found potato salad: PASS
+findLast found at EOF: PASS
+potato but not salad salad at EOF: PASS
+findLast found potato salad: PASS
+findLast found first one: PASS