summaryrefslogtreecommitdiffstats
path: root/tests/utils/testn.sh
blob: 079351d8529c1799e245cf99564b28395a768f82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
#
# Use this script to identify the command and line-number of test-cases.
#

if [ -z "${1}" -a -z "${2}" ]
then
        echo "Usage: ${0} path/to/test/case.t testnumber"
        exit 1
elif [ -z "${2}" ]
then
        echo "ERROR: The second parameter to ${0} should be a number."
        exit 2
fi

awk '{print FNR " " $0}' ${1} | egrep '^[[:digit:]]+[[:space:]]*(EXPECT|TEST|EXPECT_WITHIN|EXPECT_KEYWORD)' | sed -n ${2}p