aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qtest
diff options
context:
space:
mode:
Diffstat (limited to 'libtests/qtest')
-rw-r--r--libtests/qtest/closedfile/output1
-rw-r--r--libtests/qtest/json.test17
-rw-r--r--libtests/qtest/json/json.out23
-rw-r--r--libtests/qtest/matrix.test15
-rw-r--r--libtests/qtest/numrange.test63
-rw-r--r--libtests/qtest/qutil/qutil.out24
6 files changed, 143 insertions, 0 deletions
diff --git a/libtests/qtest/closedfile/output b/libtests/qtest/closedfile/output
index 7a5554af..596d1462 100644
--- a/libtests/qtest/closedfile/output
+++ b/libtests/qtest/closedfile/output
@@ -1,3 +1,4 @@
testing with ClosedFileInputSource
+testing with ClosedFileInputSource in stay open mode
testing with FileInputSource
all assertions passed
diff --git a/libtests/qtest/json.test b/libtests/qtest/json.test
new file mode 100644
index 00000000..b62994d3
--- /dev/null
+++ b/libtests/qtest/json.test
@@ -0,0 +1,17 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+chdir("json") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+my $td = new TestDriver('json');
+
+$td->runtest("json",
+ {$td->COMMAND => "json"},
+ {$td->FILE => "json.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+
+$td->report(1);
diff --git a/libtests/qtest/json/json.out b/libtests/qtest/json/json.out
new file mode 100644
index 00000000..f06cc1fb
--- /dev/null
+++ b/libtests/qtest/json/json.out
@@ -0,0 +1,23 @@
+--- top-level type mismatch
+top-level object is supposed to be a dictionary
+---
+--- top-level type mismatch
+json key "./one./a": key "/q" is present in schema but missing in object
+json key "./one./a./r" is supposed to be a dictionary
+json key "./one./a./s" is supposed to be an array
+json key "./one./a": key "/t" is not present in schema but appears in object
+json key "./two.1": key "/glarp" is present in schema but missing in object
+json key "./two.1": key "/flarp" is not present in schema but appears in object
+json key "./two.2" is supposed to be a dictionary
+json key "./two.3" is supposed to be a dictionary
+---
+--- top-level schema array error
+top-level object schema array contains other than one item
+---
+--- lower-level schema array error
+json key "./one./a./r" schema array contains other than one item
+json key "./two" schema array contains other than one item
+---
+--- pass
+---
+end of json tests
diff --git a/libtests/qtest/matrix.test b/libtests/qtest/matrix.test
new file mode 100644
index 00000000..90522f9c
--- /dev/null
+++ b/libtests/qtest/matrix.test
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+require TestDriver;
+
+my $td = new TestDriver('matrix');
+
+$td->runtest("matrix",
+ {$td->COMMAND => "matrix"},
+ {$td->STRING => "matrix tests done\n", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+
+$td->report(1);
diff --git a/libtests/qtest/numrange.test b/libtests/qtest/numrange.test
new file mode 100644
index 00000000..9acf6ea4
--- /dev/null
+++ b/libtests/qtest/numrange.test
@@ -0,0 +1,63 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+require TestDriver;
+
+my $td = new TestDriver('numrange');
+
+my @nrange_tests = (
+ [",5",
+ "error at * in numeric range *,5: unexpected separator",
+ 2],
+ ["4,,5",
+ "error at * in numeric range 4,*,5: unexpected separator",
+ 2],
+ ["4,5,",
+ "error at * in numeric range 4,5,*: number expected",
+ 2],
+ ["z1,",
+ "error at * in numeric range z*1,: digit not expected",
+ 2],
+ ["1z,",
+ "error at * in numeric range 1*z,: z not expected",
+ 2],
+ ["1-5?",
+ "error at * in numeric range 1-5*?: unexpected character",
+ 2],
+ ["1-30",
+ "error in numeric range 1-30: number 30 out of range",
+ 2],
+ ["1-10,0,5",
+ "error in numeric range 1-10,0,5: number 0 out of range",
+ 2],
+ ["1-10,1234,5",
+ "error in numeric range 1-10,1234,5: number 1234 out of range",
+ 2],
+ ["1,r,3",
+ "error in numeric range 1,r,3: number 16 out of range",
+ 2],
+ ["1,r16,3",
+ "error in numeric range 1,r16,3: number 0 out of range",
+ 2],
+ ["1,3,5-10,z-13,13,9,z,2,r2-r4",
+ "numeric range 1,3,5-10,z-13,13,9,z,2,r2-r4" .
+ " -> 1 3 5 6 7 8 9 10 15 14 13 13 9 15 2 14 13 12",
+ 0],
+ ["r1-r15", # r\d+ at end
+ "numeric range r1-r15" .
+ " -> 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1",
+ 0],
+ );
+foreach my $d (@nrange_tests)
+{
+ my ($range, $output, $status) = @$d;
+ $td->runtest("numeric range $range",
+ {$td->COMMAND => ['numrange', $range],
+ $td->FILTER => "grep 'numeric range'"},
+ {$td->STRING => $output . "\n", $td->EXIT_STATUS => $status},
+ $td->NORMALIZE_NEWLINES);
+}
+
+$td->report(scalar(@nrange_tests));
diff --git a/libtests/qtest/qutil/qutil.out b/libtests/qtest/qutil/qutil.out
index 8223bf5b..c35f22e3 100644
--- a/libtests/qtest/qutil/qutil.out
+++ b/libtests/qtest/qutil/qutil.out
@@ -47,6 +47,30 @@ HAGOOGAMAGOOGLE: 0
0xdead -> ff fd
0x7fffffff -> ff fd
0x80000000 -> ff fd
+---- utf8_to_ascii
+¿Does π have fingers?
+?Does ? have fingers?
+*Does * have fingers?
+<bf>Does * have fingers?
+<c0>Does * have fingers?
+---- transcoding
+bidirectional pdf doc done
+bidirectional win ansi done
+bidirectional mac roman done
+analysis done
+alternatives
+0: 86a9e99e
+1: c692c2a9c3a9c5be
+2: e280a0c2a9c3a9c5be
+3: c39cc2a9c388c3bb
+4: 83a9e99e
+5: 81a9e99e
+6: dca9c8fb
+0: c692c2a9c3a9c5be
+1: 86a9e99e
+2: 83a9e99e
+0: 717561636b
+done alternatives
---- whoami
quack1
quack2