summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2014-01-24 18:30:32 -0800
committerVijay Bellur <vbellur@redhat.com>2014-01-25 02:48:03 -0800
commit9a34ea6a0a95154013676cabf8528b2679fb36c4 (patch)
tree74481804931b2d995de97a692ada5487279f05eb /tests
parentd9fbebde0d2ae166c750121f807c440f6ea65478 (diff)
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 <avati@redhat.com> Reviewed-on: http://review.gluster.org/6788 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/include.rc8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/include.rc b/tests/include.rc
index 0369d26109b..44259872a9d 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";
}