summaryrefslogtreecommitdiff
path: root/t/re/subst.t
Commit message (Collapse)AuthorAgeFilesLines
* Add warning_like() in test.pl to replace some uses of ReTest.pl's must_warn().Nicholas Clark2011-03-051-17/+6
| | | | | | | warning_like() provides a subset of the functionality of the routine of the same name in Test::Warn. Remove the definition of must_warn() in t/re/subst.t, which had been copied from t/re/ReTest.pl from when ReTest.pl and test.pl clashed.
* fix a s/non-utf8/is-utf8/ bit of nastinessDavid Mitchell2011-02-061-1/+19
| | | | | | | | | | | | | Commit 3e462cdc2087ddf90984010fabd80c30db92bfa0 provided a fix for the s/non-utf8/is-utf8/ case by upgrading TARG to UTF8 after the match, but before the substitution. It used sv_utf8_upgrade() rather than sv_utf8_upgrade_nomg(), so for example, with a tied variable, FETCH would get called again, and all the char* pointers such as s would be left dangling. If the length of the string was unchanged, the code wouldn't notice this. Fix by using the _nomg() variant, and by checking whether the string has been reallocated
* s///r leaks like a sieveFather Chrysostomos2010-11-021-1/+6
|
* Don’t capitalise words in the middle of an error messageFather Chrysostomos2010-11-021-1/+1
|
* [perl #19078] wrong match order inside replacementFather Chrysostomos2010-09-201-1/+23
| | | | | | | | | | | | | | | | | | | | | | $ perl -le '$_="CCCGGG"; s!.!@a{print("[$&]"),/./}!g' [C] [C] [C] [C] [C] [C] What’s happening is that the s/// does not reset PL_curpm for each iteration, because it doesn’t usually have to. The RHS’s scoping takes care of it most of the time. This happens with the /e modifier and with @{...}. In this example, though, we have a subscript, not a block. This sub- script is in the same scope as the s/// itself. The assumption that the substitution operator will never have to reset PL_curpm itself appears to be incorrect. This fixes it.
* Add missing bug numbersFather Chrysostomos2010-09-201-1/+1
|
* Add tests for \400 for "" strings, s//replacement/Karl Williamson2010-07-171-1/+12
| | | | Signed-off-by: David Golden <dagolden@cpan.org>
* Add s///r (non-destructive substitution).David Caldwell2010-05-221-1/+80
| | | | | | | | | | | | | | | | This changes s/// so that it doesn't act destructively on its target. Instead it returns the result of the substitution (or the original string if there was no match). In addition this patch: * Adds a new warning when s///r happens in void context. * Adds a error when you try to use s///r with !~ * Makes it so constant strings can be bound to s///r with =~ * Adds documentation. * Adds some tests. * Updates various debug code so it knows about the /r flag. * Adds some new 'r' words to B::Deparse.
* [perl #41530] s/non-utf8/is-utf8/ fails.Karl Williamson2010-05-171-1/+21
| | | | | | | | | | When the replacement is in utf8, there was failure to upgrade the result when the source and the pattern weren't in utf8. This simply checks that when there is a match that will lead to the replacement being done. It then does the upgrade. If this led to changes in the source, we redo the match because pointers to saved buffers could have changed. There may be other cases where we don't need to redo the match, but I don't know the code well-enough to easily figure it out.
* fix qr// and get-magic problemsFather Chrysostomos2010-01-191-1/+17
| | | | | [N.B. I converted package name separators from q{'} to q{::} in the test files as suggested by demerphq. -- dagolden]
* move regex related tests out of t/op/ into t/re/Yves Orton2009-09-101-0/+600