From 9a00814bd33bb60bbfefc25dacef7ee417be4ad3 Mon Sep 17 00:00:00 2001 From: xonix Date: Thu, 14 Oct 2021 14:49:50 +0300 Subject: [PATCH] Improve parsing algorithm to handle spaces and comments #63 --- makesure.awk | 4 ++-- tests/21_parsing '.txt | 1 + tests/21_parsing.tush | 11 ++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 tests/21_parsing '.txt diff --git a/makesure.awk b/makesure.awk index 0839bea..26e3ca3 100755 --- a/makesure.awk +++ b/makesure.awk @@ -432,9 +432,9 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) { resolveGoalsToRun(resolvedGoals) if ("-d" in Args || "--resolved" in Args) { - printf("Resolved goals to reach for '%s':\n", join(ArgGoals, 0, arrLen(ArgGoals), " ")) + printf("Resolved goals to reach for '%s':\n", join(ArgGoals, 0, arrLen(ArgGoals), " ")) # TODO for (i = 0; i in resolvedGoals; i++) { - print " " resolvedGoals[i] + print " " quote2(resolvedGoals[i]) } } else { for (i = 0; i in resolvedGoals; i++) { diff --git a/tests/21_parsing '.txt b/tests/21_parsing '.txt new file mode 100644 index 0000000..af5681b --- /dev/null +++ b/tests/21_parsing '.txt @@ -0,0 +1 @@ +single quote diff --git a/tests/21_parsing.tush b/tests/21_parsing.tush index 3d8c592..397fd38 100644 --- a/tests/21_parsing.tush +++ b/tests/21_parsing.tush @@ -1,9 +1,11 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_spaces.sh -la | Available goals: +| $'21_parsing \'.txt' | '21_parsing 1.txt' | '21_parsing 2.txt' -| 21_parsing*.txt +| '21_parsing*.txt' +| $'g1@21_parsing \'.txt' | 'g1@21_parsing 1.txt' | 'g1@21_parsing 2.txt' | g1 @@ -39,6 +41,13 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_quoting.sh -l | $'name with \' quote' : name with ' quote | default +$ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_quoting.sh -d +| Resolved goals to reach for 'default': +| no_space +| 'name with spaces' +| $'name with \' quote' +| default + $ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_quoting.sh | goal 'no_space' ... | no_space