Skip to content

Commit

Permalink
Revamp @define #140 : fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Sep 18, 2023
1 parent 3ebdf9b commit b270aec
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
3 changes: 2 additions & 1 deletion makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
6 changes: 3 additions & 3 deletions tests/200_update.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
45 changes: 45 additions & 0 deletions tests/28_revamp_define.tush
Original file line number Diff line number Diff line change
@@ -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].

0 comments on commit b270aec

Please sign in to comment.