Blame tests/fgrep-longest
|
Packit |
709fb3 |
#! /bin/sh
|
|
Packit |
709fb3 |
# With multiple matches, grep -Fo could print a shorter one.
|
|
Packit |
709fb3 |
# This bug affected grep versions 2.26 through 2.27.
|
|
Packit |
709fb3 |
#
|
|
Packit |
709fb3 |
# Copyright (C) 2017 Free Software Foundation, Inc.
|
|
Packit |
709fb3 |
#
|
|
Packit |
709fb3 |
# Copying and distribution of this file, with or without modification,
|
|
Packit |
709fb3 |
# are permitted in any medium without royalty provided the copyright
|
|
Packit |
709fb3 |
# notice and this notice are preserved.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
fail=0
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# The erroneous versions would print "c", rather than the longer match, "bce".
|
|
Packit |
709fb3 |
printf 'abce\n' > in || framework_failure_
|
|
Packit |
709fb3 |
printf 'abcd\nc\nbce\n' > pat || framework_failure_
|
|
Packit |
709fb3 |
printf 'bce\n' > exp || framework_failure_
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
LC_ALL=C grep -Fof pat in > out || fail=1
|
|
Packit |
709fb3 |
compare exp out || fail=1
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
Exit $fail
|