#!/bin/sh

# $Id: grep,v 1.5 2000/04/13 08:32:33 phil Exp $
# Copyright (c) 1998  Philip Hands <phil@hands.com>
# This program is distributed under the terms of the GPL.

# Example test script, for use with the debian-test package, for
# testing that grep is vaguely functional.

# check that grep is installed
test -e /bin/grep || exit 0
##
# we need to do this pre-run check for default-tests, but a package's
# own tests don't need to bother, because they are only present if the
# package is actually installed

. ${DEBIANTEST_LIB:-/usr/lib/debian-test/lib}/functions.sh

test_simple() {
  test "feeble" = `echo -e "this\nis\na\nfeeble\ntest" | grep 'fee'`
}

test_bo() {
  test "10:feeble" = `echo -e "this\nis\na\nfeeble\ntest" | grep -b 'fee'`
}

runtest "Simple substring"                     test_simple
runtest "Simple substring, with byte offset"   test_bo 
