diff --git a/makesure.awk b/makesure.awk index 5fd7a64..863f662 100755 --- a/makesure.awk +++ b/makesure.awk @@ -250,7 +250,7 @@ function handleGoalGlob( goalName,globAllGoal,globSingle,priv,i,pattern,nfMax, } else pattern = $(nfMax = 4) if (NF > nfMax && "@params" != $(nfMax + 1)) - addError("nothing or @params allowed after glob pattern") + addError("nothing or @params allowed after glob pattern") else if (pattern == "") addError("absent glob pattern") else { @@ -915,7 +915,9 @@ function reparseCli( res,i,err) { $(++NF) = res[i] # validation according to https://github.com/xonixx/makesure/issues/141 for (i = 2; i <= NF; i++) - if ("\"" == res[i - 1, "quote"] && !("@define" == $1 && 3 == i || "@depends_on" == $1 && "@args" == $3 && i > 3)) { + if ("\"" == res[i - 1, "quote"] && !("@define" == $1 && 3 == i || + "@depends_on" == $1 && "@args" == $3 && i > 3 || + "@goal" == $1 && "@glob" == $(i - 1))) { addError("Wrong quoting: " $i) return 0 } diff --git a/makesure_candidate b/makesure_candidate index 8518aba..5813d2f 100755 --- a/makesure_candidate +++ b/makesure_candidate @@ -180,7 +180,7 @@ function handleGoalGlob(goalName,globAllGoal,globSingle,priv,i,pattern,nfMax,gi, }else pattern=$(nfMax=4) if(NF>nfMax&&"@params"!=$(nfMax+1)) - addError("nothing or @params allowed after glob pattern") + addError("nothing or @params allowed after glob pattern") else if(pattern=="") addError("absent glob pattern") else { @@ -639,7 +639,9 @@ function reparseCli(res,i,err){ for(i=NF=0;i in res;i++) $(++NF)=res[i] for(i=2;i<=NF;i++) - if("\""==res[i-1,"quote"]&&!("@define"==$1&&3==i||"@depends_on"==$1&&"@args"==$3&&i>3)){ + if("\""==res[i-1,"quote"]&&!("@define"==$1&&3==i|| +"@depends_on"==$1&&"@args"==$3&&i>3|| +"@goal"==$1&&"@glob"==$(i-1))){ addError("Wrong quoting: "$i) return 0} return 1} diff --git a/minify.awk b/minify.awk index b88bfed..96a3c68 100644 --- a/minify.awk +++ b/minify.awk @@ -21,7 +21,7 @@ function minifyLine( l,subs) { gsub(/ \/ /, "/") gsub(/ \* /, "*") gsub(/ \+ /, "+") - gsub(/ \|\| /, "||") + gsub(/ \|\| */, "||") gsub(/ \| /, "|") if (/ \? /) gsub(/ : /, ":") gsub(/ \? /, "?") diff --git a/tests/28_revamp_define.tush b/tests/28_revamp_define.tush index 74e2521..f10887c 100644 --- a/tests/28_revamp_define.tush +++ b/tests/28_revamp_define.tush @@ -94,8 +94,6 @@ $ ./$MAKESURE -f tests/28_revamp_define_2_err_quoting.sh -l @ tests/28_revamp_define_2_err_quoting.sh:22: @lib "lib_name" @ Wrong quoting: @glob: @ tests/28_revamp_define_2_err_quoting.sh:24: @goal gg1 "@glob" '*.tush' -@ Wrong quoting: *.tush: -@ tests/28_revamp_define_2_err_quoting.sh:25: @goal gg2 @glob "*.tush" @ Wrong quoting: @params: @ tests/28_revamp_define_2_err_quoting.sh:27: @goal pg "@params" P @ Wrong quoting: P: diff --git a/tests/28_revamp_define_2_err_quoting.sh b/tests/28_revamp_define_2_err_quoting.sh index eedb6c7..e522904 100644 --- a/tests/28_revamp_define_2_err_quoting.sh +++ b/tests/28_revamp_define_2_err_quoting.sh @@ -22,7 +22,7 @@ @lib "lib_name" @goal gg1 "@glob" '*.tush' -@goal gg2 @glob "*.tush" +@goal gg2 @glob "*.tush" # now OK (since #165) @goal pg "@params" P diff --git a/tests/31_glob_interpolated.sh b/tests/31_glob_interpolated.sh new file mode 100644 index 0000000..e9300fb --- /dev/null +++ b/tests/31_glob_interpolated.sh @@ -0,0 +1,15 @@ + + +@goal g1 @glob "glob_test/*.txt" + echo "$ITEM" + +@define G 'glob_test' + +@goal g2 @glob "$G/*.txt" + echo "$ITEM" + +@define G1 "$G/*.txt" + +@goal g3 @glob "$G1" + echo "$ITEM" + diff --git a/tests/31_glob_interpolated.tush b/tests/31_glob_interpolated.tush new file mode 100644 index 0000000..ae68563 --- /dev/null +++ b/tests/31_glob_interpolated.tush @@ -0,0 +1,21 @@ + +$ ./$MAKESURE -f tests/31_glob_interpolated.sh g1 +| goal 'g1@glob_test/1.txt' ... +| glob_test/1.txt +| goal 'g1@glob_test/2.txt' ... +| glob_test/2.txt +| goal 'g1' [empty]. + +$ ./$MAKESURE -f tests/31_glob_interpolated.sh g2 +| goal 'g2@glob_test/1.txt' ... +| glob_test/1.txt +| goal 'g2@glob_test/2.txt' ... +| glob_test/2.txt +| goal 'g2' [empty]. + +$ ./$MAKESURE -f tests/31_glob_interpolated.sh g3 +| goal 'g3@glob_test/1.txt' ... +| glob_test/1.txt +| goal 'g3@glob_test/2.txt' ... +| glob_test/2.txt +| goal 'g3' [empty].