diff options
-rw-r--r-- | modules/sed/transform.c | 8 | ||||
-rw-r--r-- | tests/sed.at | 9 |
2 files changed, 12 insertions, 5 deletions
diff --git a/modules/sed/transform.c b/modules/sed/transform.c index 67e0de8..ec7983f 100644 --- a/modules/sed/transform.c +++ b/modules/sed/transform.c @@ -627,8 +627,4 @@ _single_transform_name_to_slist (struct transform *tr, disp = rmp[0].rm_eo; - if (rmp[0].rm_so) - if (transform_append (tr, slist, input, rmp[0].rm_so)) - return 1; - nmatches++; if (tf->match_number && nmatches < tf->match_number) @@ -640,4 +636,8 @@ _single_transform_name_to_slist (struct transform *tr, } + if (rmp[0].rm_so) + if (transform_append (tr, slist, input, rmp[0].rm_so)) + return 1; + for (segm = tf->repl_head; segm; segm = segm->next) { diff --git a/tests/sed.at b/tests/sed.at index 0f432c5..39dd99d 100644 --- a/tests/sed.at +++ b/tests/sed.at @@ -10,8 +10,12 @@ module sed sed database dequote sed 's/<(.*)>/\1/g' database default sed 's/ok-(.*)/\1/' +database n sed 's/s/@/2' +database g sed 's/s/@/2g' +dispatch map eq n database n +dispatch map eq g database g dispatch key like <*> transform key dequote dispatch default database default ]) -AT_CHECK([smaptest -c smapd.conf test ok-word test word test '<ok-word>' +AT_CHECK([smaptest -c smapd.conf test ok-word test word test '<ok-word>' n password g passwords ], [0], @@ -19,5 +23,8 @@ AT_CHECK([smaptest -c smapd.conf test ok-word test word test '<ok-word>' test word: NOTFOUND test <ok-word>: OK word +n password: OK pas@word +g passwords: OK pas@word@ ]) + AT_CLEANUP |