Fix test framework bug: needed shopt -s extglob

This commit is contained in:
Andrew Bettison 2014-04-30 11:08:53 +09:30
parent ea9de737a2
commit 525aee88c5
2 changed files with 15 additions and 9 deletions

View File

@ -870,10 +870,14 @@ _tfw_getopts() {
}
_tfw_is_float() {
local oo
_tfw_shopt oo -s extglob
local ret=1
case "$1" in
@(+([0-9])?(.+([0-9]))|*([0-9]).+([0-9]))) return 0;
@(+([0-9])?(.+([0-9]))|*([0-9]).+([0-9]))) ret=0;;
esac
return 1
_tfw_shopt_restore oo
return $ret
}
_tfw_matches_rexp() {
@ -1745,18 +1749,22 @@ fork_wait_all() {
}
_tfw_set_forklabel() {
local oo
_tfw_shopt oo -s extglob
local ret=1
case "$1" in
'%'+([[A-Za-z0-9]))
_tfw_forklabel="${1#%}"
eval _tfw_forkid="\$_tfw_fork_label_$_tfw_forklabel"
return 0
ret=0
;;
'%'*)
error "malformed fork label '$1'"
return 0
ret=0
;;
esac
return 1
_tfw_shopt_restore oo
return $ret
}
_tfw_forkterminate() {

View File

@ -1,8 +1,8 @@
#!/bin/bash
# Tests for Serval rhizome operations.
# Tests for the test framework.
#
# Copyright 2012 Serval Project, Inc.
# Copyright 2012-2014 Serval Project, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -20,8 +20,6 @@
source "${0%/*}/../testframework.sh"
shopt -s extglob
test_tfw_cmp_version() {
execute --exit-status=1 tfw_cmp_version 1 2
execute --exit-status=2 tfw_cmp_version 1.0.1 1.0.0