From b60a55a3e5ed9b9c3fa58405832bda095bb89d60 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 13 Oct 2013 21:02:00 -0400 Subject: [PATCH] Fix an incorrect example in the man page. Add shelltestrunner test specs. --- doc/man1/hath.1 | 5 ++--- test/manpage-diffed.test | 7 +++++++ test/manpage-duped.test | 6 ++++++ test/manpage-listed.test | 12 ++++++++++++ test/manpage-reduced.test | 5 +++++ test/manpage-regexed.test | 5 +++++ test/manpage-reversed.test | 8 ++++++++ 7 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 test/manpage-diffed.test create mode 100644 test/manpage-duped.test create mode 100644 test/manpage-listed.test create mode 100644 test/manpage-reduced.test create mode 100644 test/manpage-regexed.test create mode 100644 test/manpage-reversed.test diff --git a/doc/man1/hath.1 b/doc/man1/hath.1 index 6e7a618..c0d6bc0 100644 --- a/doc/man1/hath.1 +++ b/doc/man1/hath.1 @@ -40,9 +40,8 @@ This computes a (Perl-compatible) regular expression matching the input CIDR blocks. It's the default mode of operation. .P .nf -.I $ hath <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq -([^\.0-9](10)\.(0)\.(0)\.(0)[^\.0-9]|[^\.0-9](10)\.(0)\.(1) -\.(0)[^\.0-9]) +.I $ hath <<< \(dq10.0.0.0/29 10.0.0.8/29\(dq +((10)\.(0)\.(0)\.(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15)) .fi .IP \(bu 2 \fBReduced\fR diff --git a/test/manpage-diffed.test b/test/manpage-diffed.test new file mode 100644 index 0000000..5cd4f67 --- /dev/null +++ b/test/manpage-diffed.test @@ -0,0 +1,7 @@ +# Test the regexed example from the man page. +dist/build/hath/hath diffed <<< "10.0.0.0/24 10.0.1.0/24" +>>> +-10.0.0.0/24 +-10.0.1.0/24 ++10.0.0.0/23 +>>>= 0 diff --git a/test/manpage-duped.test b/test/manpage-duped.test new file mode 100644 index 0000000..f2c8bde --- /dev/null +++ b/test/manpage-duped.test @@ -0,0 +1,6 @@ +# Test the regexed example from the man page. +dist/build/hath/hath duped <<< "10.0.0.0/24 10.0.1.0/24" +>>> +10.0.0.0/24 +10.0.1.0/24 +>>>= 0 diff --git a/test/manpage-listed.test b/test/manpage-listed.test new file mode 100644 index 0000000..e9909bf --- /dev/null +++ b/test/manpage-listed.test @@ -0,0 +1,12 @@ +# Test the regexed example from the man page. +dist/build/hath/hath listed <<< "192.168.0.240/29" +>>> +192.168.0.240 +192.168.0.241 +192.168.0.242 +192.168.0.243 +192.168.0.244 +192.168.0.245 +192.168.0.246 +192.168.0.247 +>>>= 0 diff --git a/test/manpage-reduced.test b/test/manpage-reduced.test new file mode 100644 index 0000000..10a2f0c --- /dev/null +++ b/test/manpage-reduced.test @@ -0,0 +1,5 @@ +# Test the reduced example from the man page. +dist/build/hath/hath reduced <<< "10.0.0.0/24 10.0.1.0/24" +>>> +10.0.0.0/23 +>>>= 0 diff --git a/test/manpage-regexed.test b/test/manpage-regexed.test new file mode 100644 index 0000000..9b09f11 --- /dev/null +++ b/test/manpage-regexed.test @@ -0,0 +1,5 @@ +# Test the regexed example from the man page. +dist/build/hath/hath <<< "10.0.0.0/29 10.0.0.8/29" +>>> +((10)\.(0)\.(0)\.(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15)) +>>>= 0 diff --git a/test/manpage-reversed.test b/test/manpage-reversed.test new file mode 100644 index 0000000..00573fb --- /dev/null +++ b/test/manpage-reversed.test @@ -0,0 +1,8 @@ +# Test the regexed example from the man page. +dist/build/hath/hath reversed <<< "198.41.0.4/30" +>>> +198.41.0.4: a.root-servers.net. +198.41.0.5: +198.41.0.6: rs.internic.net. +198.41.0.7: +>>>= 0 -- 2.43.2