diff --git a/makesure.awk b/makesure.awk index 879d161..d9a72a9 100755 --- a/makesure.awk +++ b/makesure.awk @@ -897,6 +897,15 @@ function reparseCli( res,i,err) { $(++NF) = res[i] Quotes[NF] = res[i,"quote"] } + # validation according to https://github.com/xonixx/makesure/issues/141 + for (i = 2; i <= NF; i++) { + if ("@define" == $1 && 3 == i || "@depends_on" == $1 && "@args" == $3 && i > 3) + continue + if ("\"" == Quotes[i]) { + addError("Wrong quoting: " $i) + return -1 + } + } return 0 } function quote2(s,force) { diff --git a/tests/28_revamp_define.tush b/tests/28_revamp_define.tush index ed9d5d6..733a093 100644 --- a/tests/28_revamp_define.tush +++ b/tests/28_revamp_define.tush @@ -72,3 +72,34 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_1.sh g8 $ cd "$MYDIR"; ./$MAKESURE -f tests/28_revamp_define_2_err_quoting.sh -l +@ Wrong quoting: sh: +@ tests/28_revamp_define_2_err_quoting.sh:6: @shell "sh" +@ Wrong quoting: tracing: +@ tests/28_revamp_define_2_err_quoting.sh:7: @options "tracing" +@ Wrong quoting: NAME: +@ tests/28_revamp_define_2_err_quoting.sh:9: @define "NAME" 'value' +@ Wrong quoting: g1: +@ tests/28_revamp_define_2_err_quoting.sh:11: @goal "g1" +@ Wrong quoting: doc: +@ tests/28_revamp_define_2_err_quoting.sh:12: @doc "doc" +@ Wrong quoting: goal_name: +@ tests/28_revamp_define_2_err_quoting.sh:13: @depends_on "goal_name" +@ Wrong quoting: goal_name: +@ tests/28_revamp_define_2_err_quoting.sh:14: @depends_on goal_name1 "goal_name" +@ Wrong quoting: @private: +@ tests/28_revamp_define_2_err_quoting.sh:19: @goal g2 "@private" +@ Wrong quoting: lib_name: +@ tests/28_revamp_define_2_err_quoting.sh:20: @use_lib "lib_name" +@ Wrong quoting: lib_name: +@ 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: +@ tests/28_revamp_define_2_err_quoting.sh:29: @goal pg1 @params "P" +@ Wrong quoting: @args: +@ tests/28_revamp_define_2_err_quoting.sh:30: @depends_on pg "@args" 'value' +? 1 diff --git a/tests/28_revamp_define_2_err_quoting.sh b/tests/28_revamp_define_2_err_quoting.sh index 408b182..eedb6c7 100644 --- a/tests/28_revamp_define_2_err_quoting.sh +++ b/tests/28_revamp_define_2_err_quoting.sh @@ -11,7 +11,7 @@ @goal "g1" @doc "doc" @depends_on "goal_name" -@depends_on goal_name "goal_name" +@depends_on goal_name1 "goal_name" @goal goal_name @goal goal_name1 @@ -25,7 +25,9 @@ @goal gg2 @glob "*.tush" @goal pg "@params" P + @goal pg1 @params "P" +@depends_on pg "@args" 'value' # GOOD: