From b270aeceefce4c3d5d960cbcad7360de93759708 Mon Sep 17 00:00:00 2001 From: xonix Date: Tue, 19 Sep 2023 00:57:48 +0300 Subject: [PATCH] Revamp `@define` #140 : fix tests --- makesure.awk | 3 ++- tests/200_update.sh | 6 ++--- tests/28_revamp_define.tush | 45 +++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/makesure.awk b/makesure.awk index 1fd139f..18eacde 100755 --- a/makesure.awk +++ b/makesure.awk @@ -690,7 +690,8 @@ function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInst depArgType == "str" ? \ depArg : \ depArgType == "var" ? \ - (depArg in args ? args[depArg] : addErrorDedup("wrong arg '" depArg "'", DependenciesLineNo[gi])) : \ + (depArg in args ? args[depArg] : \ + depArg in Vars ? Vars[depArg] : addErrorDedup("wrong arg '" depArg "'", DependenciesLineNo[gi])) : \ die("wrong depArgType: " depArgType) } diff --git a/tests/200_update.sh b/tests/200_update.sh index 603f188..4535480 100644 --- a/tests/200_update.sh +++ b/tests/200_update.sh @@ -1,9 +1,9 @@ #@options tracing -@define MAKESURE_AWK="${MAKESURE_AWK:-awk}" -@define D='/tmp/dirXXX with spaces' -#@define D='/tmp/dirXXX' +@define MAKESURE_AWK "${MAKESURE_AWK:-awk}" +@define D '/tmp/dirXXX with spaces' +#@define D '/tmp/dirXXX' @goal makesure_prepared [[ -d "$D" ]] && rm -r "$D" diff --git a/tests/28_revamp_define.tush b/tests/28_revamp_define.tush index 4a6efe9..0c62f9b 100644 --- a/tests/28_revamp_define.tush +++ b/tests/28_revamp_define.tush @@ -1,15 +1,60 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_1.sh -l +| Available goals: +| g1 +| g2 +| g3 +| g4 +| g5 +| g6 +| pg@Value +| pg@Str1 +| pg2@Str1 +| pg@Str +| pg2@Value +| pg2@Str $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_1.sh g1 +| goal 'pg@Value' ... +| A=Value +| goal 'g1' [empty]. $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_1.sh g2 +| goal 'pg@Str1' ... +| A=Str1 +| goal 'g2' [empty]. $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_1.sh g3 +| goal 'pg@Str1' ... +| A=Str1 +| goal 'pg@Value' ... +| A=Value +| goal 'pg@Str' ... +| A=Str +| goal 'pg2@Str1' [empty]. +| goal 'g3' [empty]. $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_1.sh g4 +| goal 'pg@Value' ... +| A=Value +| goal 'pg@Str' ... +| A=Str +| goal 'pg2@Value' [empty]. +| goal 'g4' [empty]. $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_1.sh g5 +| goal 'pg@Value' ... +| A=Value +| goal 'pg@Str' ... +| A=Str +| goal 'pg2@Value' [empty]. +| goal 'g5' [empty]. $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_1.sh g6 +| goal 'pg@Str' ... +| A=Str +| goal 'pg@Value' ... +| A=Value +| goal 'pg2@Str' [empty]. +| goal 'g6' [empty].