Skip to content

Commit

Permalink
Natural ordering of @goal @glob is broken #64
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Oct 11, 2021
1 parent 2830076 commit 24813c7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
5 changes: 3 additions & 2 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ function prepareArgs( i,arg) {
Options["timing"]
}

#function dbgA(name, arr, i) { print "--- " name ": "; for (i in arr) print i " : " arr[i] }
#function dbgA(name, arr, i) { print "--- " name ": "; for (i in arr) printf "%2s : %s\n", i, arr[i] }
#function dbgAO(name, arr, i) { print "--- " name ": "; for (i=0;i in arr;i++) printf "%2s : %s\n", i, arr[i] }

function splitKV(arg, kv, n) {
n = index(arg, "=")
Expand Down Expand Up @@ -660,7 +661,7 @@ function natOrder(s1,s2, i1,i2, c1, c2, n1,n2) {
}

# consume till equal substrings
while ((c1 = substr(s1,i1,1)) == (c2 = substr(s2,i2,1)) && c1 != "") {
while ((c1 = substr(s1,i1,1)) == (c2 = substr(s2,i2,1)) && c1 != "" && !_digit(c1)) {
i1++; i2++
}

Expand Down
25 changes: 25 additions & 0 deletions tests/22_nat_order.tush
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,28 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/22_nat_order.sh nat_order_test
| 19_optimize_goals.tush
| 20_list_goals.tush
| 21_parsing.tush

$ cd "$MYDIR"; ./$MAKESURE -f tests/22_nat_order nat_order_test
| ../0_basic.tush
| ../1_goals.tush
| ../2_mydir.tush
| ../3_loop.tush
| ../4_trace.tush
| ../5_shell.tush
| ../6_reached_if.tush
| ../7_options.tush
| ../8_timing.tush
| ../9_prelude.tush
| ../10_define.tush
| ../11_goal_glob.tush
| ../12_errors.tush
| ../13_doc.tush
| ../14_private.tush
| ../15_lib.tush
| ../16_prelude_fail.tush
| ../17_empty_prelude.tush
| ../18_vars_priority.tush
| ../19_optimize_goals.tush
| ../20_list_goals.tush
| ../21_parsing.tush

6 changes: 6 additions & 0 deletions tests/22_nat_order/Makesurefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

@options silent

@goal nat_order_test @glob ../*.tush
@reached_if [[ $INDEX -ge 22 ]] # only check the correct order on first 22 tests
echo "$ITEM"

0 comments on commit 24813c7

Please sign in to comment.