1
1
mirror of https://github.com/tstack/lnav.git synced 2024-08-16 16:30:25 +03:00
lnav/test/test_grep_proc.sh

58 lines
876 B
Bash
Raw Normal View History

2009-12-24 21:36:01 +03:00
#! /bin/bash
2009-09-14 05:07:32 +04:00
cat > gp.dat <<EOF
Hello, World!
Goodbye, World?
EOF
grep_slice() {
2009-10-07 01:14:49 +04:00
./drive_grep_proc "$1" "$2" | ./slicer "$2"
2009-09-14 05:07:32 +04: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?" <<EOF
Hello, World!
Goodbye, World?
EOF
2009-09-14 05:07:32 +04:00
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
check_error_output "grep_proc didn't capture matches?" <<EOF
2009-09-14 05:07:32 +04:00
0(0:5)Hello
1(0:7)Goodbye
EOF
check_output "grep_proc didn't capture matches?" <<EOF
EOF