2009-12-24 18:36:01 +00:00
|
|
|
#! /bin/bash
|
2009-09-14 01:07:32 +00:00
|
|
|
|
|
|
|
cat > gp.dat <<EOF
|
|
|
|
Hello, World!
|
|
|
|
Goodbye, World?
|
|
|
|
EOF
|
|
|
|
|
|
|
|
grep_slice() {
|
2009-10-06 21:14:49 +00:00
|
|
|
./drive_grep_proc "$1" "$2" | ./slicer "$2"
|
2009-09-14 01:07:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
grep_capture() {
|
|
|
|
./drive_grep_proc "$1" "$2" 1>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
run_test grep_slice 'Hello' gp.dat
|
|
|
|
|
|
|
|
check_output "grep_proc didn't find the right match?" <<EOF
|
|
|
|
Hello
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test grep_slice '.*' gp.dat
|
|
|
|
|
|
|
|
check_output "grep_proc didn't find all lines?" < gp.dat
|
|
|
|
|
|
|
|
run_test grep_slice '\w+,' gp.dat
|
|
|
|
|
|
|
|
check_output "grep_proc didn't find the right matches?" <<EOF
|
|
|
|
Hello,
|
|
|
|
Goodbye,
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test grep_slice '\w+.' gp.dat
|
|
|
|
|
|
|
|
check_output "grep_proc didn't find multiple matches?" <<EOF
|
|
|
|
Hello,
|
|
|
|
World!
|
|
|
|
Goodbye,
|
|
|
|
World?
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test grep_capture '(\w+), World' gp.dat
|
|
|
|
|
2014-03-03 00:52:18 +00:00
|
|
|
check_error_output "grep_proc didn't capture matches?" <<EOF
|
2009-09-14 01:07:32 +00:00
|
|
|
0(0:5)Hello
|
|
|
|
1(0:7)Goodbye
|
|
|
|
EOF
|
2014-03-03 00:52:18 +00:00
|
|
|
|
|
|
|
check_output "grep_proc didn't capture matches?" <<EOF
|
|
|
|
EOF
|