diff options
author | Johannes Hörmann <[email protected]> | 2019-07-21 17:57:34 +0200 |
---|---|---|
committer | Matt Holt <[email protected]> | 2019-07-21 09:57:34 -0600 |
commit | 95a447de9c1c7e9b5dc6f560d41ad2a92ed799c7 (patch) | |
tree | de309249f4a7befbd2a9873baccea9dcfd9cfc6e /replacer.go | |
parent | d98f2faef960f549c973d747d2e7c484d6e845c7 (diff) | |
download | caddy-95a447de9c1c7e9b5dc6f560d41ad2a92ed799c7.tar.gz caddy-95a447de9c1c7e9b5dc6f560d41ad2a92ed799c7.zip |
Tests for replacer (#2675)
* Tests for Replacer: Replacer.Set and Replacer.Delete
* update replacer test to new implementation
* fix replacer: counted position wrong if placeholder was found
* fix replacer: found placeholder again, if it was a non-existing one
* test with spaces between the placeholders as this could have a different behaviour
* Tests for Replacer.Map
* Tests for Replacer.Set: check also for something like {l{test1}
This should be replaced as {lTEST1REPLACEMENT
* fix replacer: fix multiple occurrence of phOpen sign
* Tests for Replacer: rewrite Set and ReplaceAll tests to use implementation not interface
* Tests for Replacer: rewrite Delete test to use implementation not interface
* Tests for Replacer: rewrite Map tests to use implementation not interface
* Tests for Replacer: add test for NewReplacer
* Tests for Replacer: add test for default replacements
* Tests for Replacer: fixed and refactored tests
* Tests for Replacer: moved default replacement tests to New-test
as new should return a replace with provider which defines global replacements
Diffstat (limited to 'replacer.go')
-rw-r--r-- | replacer.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/replacer.go b/replacer.go index e8a4f9b13..d7beeab69 100644 --- a/replacer.go +++ b/replacer.go @@ -115,12 +115,13 @@ func (r *replacer) ReplaceAll(input, empty string) string { } } if !found { + lastWriteCursor = i continue } // advance cursor to end of placeholder - i = end + 1 - lastWriteCursor = i + i = end + lastWriteCursor = i + 1 } // flush any unwritten remainder |