From 9a34ea6a0a95154013676cabf8528b2679fb36c4 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Fri, 24 Jan 2014 18:30:32 -0800 Subject: tests: support regex in EXPECT constructs Instead of just strings, provide the ability to specify a regex of the pattern to expect Change-Id: I6ada978197dceecc28490a2a40de73a04ab9abcd Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/6788 Reviewed-by: Pranith Kumar Karampuri 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 0369d2610..44259872a 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -67,10 +67,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"; } @@ -96,11 +96,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