From 4f19f8df714c2eb654f89742fec0e71a809e7765 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 10 May 2014 01:25:08 -0700 Subject: [PATCH 2/2] tests: add test case for -C 0 change * tests/context-0: New test. * tests/Makefile.am (TESTS): Add it. --- tests/Makefile.am | 1 + tests/context-0 | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 tests/context-0 diff --git a/tests/Makefile.am b/tests/Makefile.am index 91775bd..f3450f3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -50,6 +50,7 @@ TESTS = \ case-fold-titlecase \ char-class-multibyte \ char-class-multibyte2 \ + context-0 \ dfa-coverage \ dfa-heap-overrun \ dfaexec-multibyte \ diff --git a/tests/context-0 b/tests/context-0 new file mode 100755 index 0000000..4b63305 --- /dev/null +++ b/tests/context-0 @@ -0,0 +1,27 @@ +#!/bin/sh +# 0 lines of context +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +cat < in || framework_failure_ +needle +1st line of context +2nd line of context +3rd line of context +another needle +5th line of context relative to first match +6th line... +EOF + +cat < exp || framework_failure_ +needle +-- +another needle +EOF + +fail=0 +grep -C 0 needle in > out 2>err || fail=1 + +compare exp out || fail=1 +compare /dev/null err || fail=1 + +Exit $fail -- 1.9.0