From bf737d691cf812b40594e64c4c52f3c677a04e35 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Fri, 4 Jul 2014 11:23:12 +0530 Subject: tests: support regex in EXPECT constructs Backport of http://review.gluster.org/6788 Instead of just strings, provide the ability to specify a regex of the pattern to expect Change-Id: I288db2290612accd795c3498f74e8b70bab21f2c BUG: 1115369 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/8235 Reviewed-by: Ravishankar N Reviewed-by: Niels de Vos Tested-by: Gluster Build System --- tests/include.rc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/include.rc b/tests/include.rc index 41c4f332982..a1713880d84 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -68,10 +68,10 @@ function test_expect_footer() local a=$2 local err="" - if [ "x${e}" != "x${a}" ]; then + if ! [[ "$a" =~ $e ]]; then err="Got \"$a\" instead of \"$e\"" fi - [[ "x${e}" == "x${a}" ]]; + [[ "$a" =~ $e ]]; test_footer "$err"; } @@ -97,11 +97,11 @@ function test_expect_not_footer() local a=$2 local err="" - if [ "x${e}" == "x${a}" ]; then + if [[ "$a" =~ $e ]]; then err="Got \"$a\" when not expecting it" fi - [[ "x${e}" != "x${a}" ]]; + ! [[ "$a" =~ "$e" ]]; test_footer "$err"; } -- cgit