summaryrefslogtreecommitdiff
path: root/t/lib
Commit message (Collapse)AuthorAgeFilesLines
* Add (?^...) regex constructKarl Williamson2010-09-201-0/+5
| | | | | | | | | | | | | | | | | | This adds (?^...) to signify to use the default regex modifiers for the cluster or embedded pattern-match modifier change. The major purpose of this is to simplify regex stringification, so that "^" is output in place of "-xism". As a result, the stringification will not change in the future when new regex modifiers are added, so tests, etc. that rely on a particular stringification will have to change now, but never again. Code that needs to work properly with both old- and new-style regexes can use something like the following: # Accept both old and new-style stringification my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? '^' : '-xism'; This construct is Ben Morrow's idea.
* Fix /[\8]/ to not match NULL; give correct warningKarl Williamson2010-09-161-0/+13
| | | | | | | | | | 8 and 9 are not treated as alphas in parsing as opposed to illegal octals. This also adds tests to verify that 1-3 digits work in char classes. I created an isOCTAL macro in case that lookup gets moved to a bit field, as I plan to do later, for speed.
* segfault on &Internals::* due to missing SvROK()Ævar Arnfjörð Bjarmason2010-09-111-0/+25
| | | | | | | | | | | | | | | | | | | | Change the &Internals::* functions that use references in their prototypes to check if the argument is SvROK() before calling SvRV(). If the function is called as Internals::FOO() perl does this check for us, but prototypes are bypassed on &Internals::FOO() so we still have to check this manually. This fixes [perl #77776], this bug was present in 5.10.x, 5.12.x, and probably all earlier perl versions that had these functions, but I haven't tested that. I'm adding a new test file (t/lib/universal.t) to test universal.c functions as part of this patch. The testing for Internal::* in t/ was and is very sparse, but before universal.t there was no obvious place to put these tests. Signed-off-by: Ævar Arnfjörð Bjarmason <avar@cpan.org>
* improve registration of warning categoriesRicardo Signes2010-09-101-0/+18
| | | | | | | | | | | | | | | | | | | | 1. &warnings::register is added as the public mechanism for adding new warning categories, rather than warnings::register::import knowing about warnings's internals 2. warnings::register::import is updated to use &warnings::register 3. warnings::register::import can take a list of subcategories The upshot is that you can now write: package MyTool; use warnings::register qw(io typos); warnings::warnif('MyTool::io', $message); ...and tools that register new warnings categories do not need to cargo cult code from warnings/register.pm
* make qw(...) first-class syntaxZefram2010-09-081-0/+235
| | | | | | | | | | This makes a qw(...) list literal a distinct token type for the parser, where previously it was munged into a "(",THING,")" sequence. The change means that qw(...) can't accidentally supply parens to parts of the grammar that want real parens. Due to many bits of code taking advantage of that by "foreach my $x qw(...) {}", this patch also includes a hack to coerce qw(...) to the old-style parenthesised THING, emitting a deprecation warning along the way.
* t/lib/common.pl must convert $^X to an absolute path before changing directory.Nicholas Clark2010-09-011-1/+2
| | | | Not every operating system has /proc/self/exe
* Tests using t/lib/common.pl need to run in separate directories.Nicholas Clark2010-09-014-17/+33
| | | | | | | Commit 8f776eae73090661 turned out to be a bit optimistic with "should be capable of running in parallel", as the temporary files and modules written out by the various test scripts have clashing names. Hence run each test a private subdirectory.
* Add test for deprecation warnings from h2phFlorian Ragwitz2010-09-012-0/+9
| | | | This makes sure the fix for RT#74404 is working.
* fix [perl #74118] $[ assignment not noisy enoughZefram2010-08-161-1/+6
| | | | | Warn about list assignment to $[, as in "($[)=1", in addition to scalar assignment such as "$[=1".
* use charnames (); failsKarl Williamson2010-08-131-0/+10
| | | | | | If "use charnames ()" are the only usages of this pragma in a program, it fails due to the pragma's import method not getting called. This fixes that.
* Merge remote branch 'khwilliamson/ncharnames' into bleadRafael Garcia-Suarez2010-07-271-1/+47
|\ | | | | | | | | Conflicts: pod/perl5133delta.pod
| * t/lib/charnames/alias: Add explicit warnings setsKarl Williamson2010-07-131-0/+46
| | | | | | | | This makes this more immune to ENV differences
| * charnames: Fix scoping bugsKarl Williamson2010-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done by moving what could to %^H. Because data structures in %^H get stringified at runtime, new serialized entries for them had to be created and then unserialized on each runtime call. Also, because %^H is read-only at runtime, some data structures couldn't be moved to it. Things were set up so that these contain only things invariant under scoping, and looked at only when the same scoped options are in effect as when they were created. Further comments at declaration of %full_names_cache. I was well into this patch when it dawned on me that it was doing unnecessary tests, so that if (! a) { conditionally set a } if (! a) {} could be implemented more efficiently as if (! a) { conditionally set a } if (! a) {} } so I changed it, which messes up leading indentation for the diffs.
* | Change function signature of grok_bslash_oKarl Williamson2010-07-271-6/+6
| | | | | | | | The previous return value where NULL meant OK is outside-the-norm.
* | Add \o{} escapeKarl Williamson2010-07-172-0/+53
|/ | | | | | | | | | This commit adds the new construct \o{} to express a character constant by its octal ordinal value, along with ancillary tests and documentation. A function to handle this is added to util.c, and it is called from the 3 parsing places it could occur. The function is a candidate for in-lining, though I doubt that it will ever be used frequently.
* PATCH: t/lib/common.pl localized $/ setting; allow input 'no_plan'karl williamson (via RT)2010-07-081-2/+8
| | | | | | | | | | | | | | | | | | # New Ticket Created by karl williamson # Please include the string: [perl #76398] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=76398 > See attached patches >From 275169a8df5851331669da2dd791483379c3fc5e Mon Sep 17 00:00:00 2001 From: Karl Williamson <khw@khw-desktop.(none)> Date: Tue, 6 Jul 2010 09:20:42 -0600 Subject: [PATCH] t/lib/common.pl: localize changing $/ $/ changes should not affect callers. Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
* t/lib/common.pl can use caller to infer the name of the pragma under test.Nicholas Clark2010-07-011-1/+3
| | | | | | | This avoids needing to use a variable in package main to pass in information. Also, remove an unnecessary $ENV{PERL5LIB} assignment cargo-culted into most users of t/lib/common,pl, and remove the BEGIN block as the code it contained doesn't need to run at BEGIN time.
* Convert subs.t to use t/lib/common.plNicholas Clark2010-07-012-1/+84
|
* Convert charnames.t to use t/lib/common.plNicholas Clark2010-07-012-3/+247
|
* Convert strict.t to use t/lib/common.plNicholas Clark2010-07-011-2/+2
|
* Deprecate no space after s/a/b/ and keywordKarl Williamson2010-06-281-1/+4
| | | | | Pattern replacements need to have the deprecation added; the prior patch on this ticket only changed m/a/keyword; this adds the s/a/b/keyword
* Deprecate no space between pattern, following wordKarl Williamson2010-06-181-1/+4
| | | | | | | This patch raises a deprecated warning on constructs like $result = $a =~ m/$foo/sand $bar; which means $result = $a =~ m/$foo/s and $bar;
* [perl #70075] no 6; brokenFather Chrysostomos2010-05-311-0/+4
| | | | | the original patch included a fix, but this problem was fixed in faee19b5, so only apply the test.
* Revert "New deprecation warning: Dot after %s literal is concatenation"Jesse Vincent2010-05-051-17/+0
| | | | | | | This reverts commit 6fb472bab4fadd0ae2ca9624b74596afab4fb8cb. Zefram asked me to revert this as he's going to be doing something more pluggable
* Revert "Fix tests and add one more test for the deprecation warning added in ↵Jesse Vincent2010-05-051-7/+6
| | | | | | | | | last change" This reverts commit c4deb7365787eb01845a9d0e371e343169530659. Zefram asked me to revert this as he's going to be doing something more pluggable
* Revert "tweak "0x123.456" deprecation"Jesse Vincent2010-05-051-3/+3
| | | | | | | This reverts commit 1183a10042af0734ee65e252f15bd820b7bbe686. Zefram asked me to revert this as he's going to be doing something more pluggable
* Merge remote branch 'zefram/zefram/reliable_exception' into bleadRafael Garcia-Suarez2010-05-041-0/+18
|\ | | | | | | | | Conflicts: pp_ctl.c
| * bring G_KEEPERR back to the realm of sanityZefram2010-04-231-0/+18
| | | | | | | | | | | | | | | | | | Makes the G_KEEPERR logic more consistent, and in particular make it sensibly handle non-string exceptions. An exception in a destructor is now always emitted as a warning, and never copied or merged into $@ of the surrounding context. No more clobbering exceptions being handled elsewhere, and no more double reporting. This fixes the rest of [perl #74538].
* | tweak "0x123.456" deprecationZefram2010-05-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Some improvements to the deprecation added in commit 6fb472bab4fadd0ae2ca9624b74596afab4fb8cb: - warning message includes the word "deprecated" - warning is in "syntax" category as well as "deprecated" - more systematic tests - dot detected more efficiently by incorporation into existing switch - small doc rewording - avoid the warning in t/op/taint.t
* | Fix tests and add one more test for the deprecation warning added in last changeRafael Garcia-Suarez2010-04-231-6/+7
| |
* | New deprecation warning: Dot after %s literal is concatenationJames Mastros2010-04-231-0/+17
|/
* [perl #73712] ‘Variable is not imported’ cannot be suppressedFather Chrysostomos2010-04-131-0/+7
| | | | | | | | | | | | | | | | The message ‘Variable "%s" is not imported’ cannot be suppressed, even with -X (local $SIG{__WARN__}=sub{} is what I have to use): perl -Xle '$foo;use strict; eval q/$foo/ or die "---$@---"' Variable "$foo" is not imported at (eval 1) line 2. ---Global symbol "$foo" requires explicit package name at (eval 1) line 2. --- at -e line 1. This is because we have what appears to the user to be a multi-line error message. It is in fact a warning ‘Variable...’ followed by an error ‘Global symbol...’. The attached patch assigns a warning category to the warning.
* Fix test comment (noticed by Alex Vandiver)Rafael Garcia-Suarez2010-04-131-1/+1
|
* [perl #74168] Assertion failure when emitting a stricture error messageRafael Garcia-Suarez2010-04-091-0/+6
|
* Support cygwin-1.7 mountReini Urban2010-03-081-3/+3
|
* PATCH: [perl #56444] delayed interpolation of \N{...}Karl Williamson2010-02-191-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | make regen embed.fnc needs to be run on this patch. This patch fixes Bugs #56444 and #62056. Hopefully we have finally gotten this right. The parser used to handle all the escaped constants, expanding \x2e to its single byte equivalent. The problem is that for regexp patterns, this is a '.', which is a metacharacter and has special meaning that \x2e does not. So things were changed so that the parser didn't expand things in patterns. But this causes problems for \N{NAME}, when the pattern doesn't get evaluated until runtime, as for example when it has a scalar reference in it, like qr/$foo\N{NAME}/. We want the value for \N{NAME} that was in effect at the point during the parsing phase that this regex was encountered in, but we don't actually look at it until runtime, when these bug reports show that it is gone. The solution is for the tokenizer to parse \N{NAME}, but to compile it into an intermediate value that won't ever be considered a metacharacter. We have chosen to compile NAME to its equivalent code point value, and express it in the already existing \N{U+...} form. This indicates to the regex compiler that the original input was a named character and retains the value it had at that point in the parse. This means that \N{U+...} now always must imply Unicode semantics for the string or pattern it appeared in. Previously there was an inconsistency, where effectively \N{NAME} implied Unicode semantics, but \N{U+...} did not necessarily. So now, any string or pattern that has either of these forms is utf8 upgraded. A complication is that a charnames handler can return a sequence of multiple characters instead of just one. To deal with this case, the tokenizer will generate a constant of the form \N{U+c1.c2.c2...}, where c1 etc are the individual characters. Perhaps this will be made a public interface someday, but I decided to not expose it externally as far as possible for now in case we find reason to change it. It is possible to defeat this by passing it in a single quoted string to the regex compiler, so the documentation will be changed to discourage that. A further complication is that \N can have an additional meaning: to match a non-newline. This means that the two meanings have to be disambiguated. embed.fnc was changed to make public the function regcurly() in regcomp.c so that it could be referred to in toke.c to see if the ... in \N{...} is a legal quantifier like {2,}. This is used in the disambiguation. toke.c was changed to update some out-dated relevant comments. It now parses \N in patterns. If it determines that it isn't a named sequence, it passes it through unchanged. This happens when there is no brace after the \N, or no closing brace, or if the braces enclose a legal quantifier. Previously there has been essentially no restriction on what can come between the braces so that a custom translator can accept virtually anything. Now, legal quantifiers are assumed to mean that the \N is a "match non-newline that quantity of times". I removed the #ifdef'd out code that had been left in in case pack U reverted to earlier behavior. I did this because it complicated things, and because the change to pack U has been in long enough and shown that it is correct so it's not likely to be reverted. \N meaning a named character is handled differently depending on whether this is a pattern or not. In all cases, the output will be upgraded to utf8 because a named character implies Unicode semantics. If not a pattern, the \N is parsed into a utf8 string, as before. Otherwise it will be parsed into the intermediate \N{U+...} form. If the original was already a valid \N{U+...} constant, it is passed through unchanged. I now check that the sequence returned by the charnames handler is not malformed, which was lacking before. The code in regcomp.c which dealt with interfacing with the charnames handler has been removed. All the values should be determined by the time regcomp.c gets involved. The affected subroutine is necessarily restructured. An EXACT-type node is generated for the character sequence. Such a node has a capacity of 255 bytes, and so it is possible to overflow it. This wasn't checked for before, but now it is, and a warning issued and the overflowing characters are discarded.
* change non-char warning message from malformedKarl Williamson2009-12-201-0/+3
|
* Introduce C<use feature "unicode_strings">Rafael Garcia-Suarez2009-12-201-0/+19
| | | | | | | | | | | | | This turns on the unicode semantics for uc/lc/ucfirst/lcfirst operations on strings without the UTF8 bit set but with ASCII characters higher than 127. This replaces the "legacy" pragma experiment. Note that currently this feature sets both a bit in $^H and a (unused) key in %^H. The bit in $^H could be replaced by a flag on the uc/lc/etc op. It's probably not feasible to test a key in %^H in pp_uc in friends each time we want to know which semantics to apply.
* Make split warn in void contextRafael Garcia-Suarez2009-11-291-0/+12
|
* Add tests.Andrew Rodland2009-11-241-0/+57
|
* As our $_; is forced into main::, it should warn as a redeclaration.Nicholas Clark2009-11-121-0/+15
|
* Deprecate use of := to mean an empty attribute list in my $pi := 4;Nicholas Clark2009-11-041-0/+59
| | | | | | | | | | | An accident of Perl's parser meant that my $pi := 4; was parsed as an empty attribute list. Empty attribute lists are ignored, hence the above is equivalent to my $pi = 4; However, the fact that it is currently valid syntax means that := cannot be used as new token, without silently changing the meaning of existing code. Hence it is now deprecated, so that it can subsequently be removed, allowing the possibility of := to be used as a new token with new semantics.
* add an elipses to string/ref warnings when str longer than 32 charsYves Orton2009-10-261-0/+8
| | | | | | Wasted a few minutes more than necessary trying to work out why the string was truncated when in fact it was the error message that was truncating the string.
* Make defined %hash on a non-lexical (also) generate a deprecated warning.Nicholas Clark2009-10-241-0/+2
| | | | | Tk has been fixed, and no longer uses defined %stash:: to determine if a package has been loaded.
* Enable deprecation warnings by default.Nicholas Clark2009-10-162-28/+20
|
* overload no longer implicitly unsets fallback on repeated 'use overload' ↵Geoffrey T. Dairiki2009-10-121-0/+18
| | | | | | | | lines - Fix for RT#68916 Subject: overload::import resets the setting of 'fallback' Date: Tue, 04 Aug 2009 17:54:34 -0700 From: "Geoffrey T. Dairiki" <dairiki at dairiki.org>
* Standardise t/lib/*.t on ./test.pl, and remove BEGIN boilerplate.Nicholas Clark2009-10-064-13/+14
|
* Change warning "Unicode character is illegal" to more accurate descriptionRafael Garcia-Suarez2009-10-031-12/+12
| | | | | That now reads "Unicode non-character is illegal in interchange" and the perldiag documentation is expanded a bit.
* Move 3 porting sanity tests from t/lib/ to t/porting/, a more natural home.Nicholas Clark2009-09-303-145/+0
|
* Update URL to the current Perl-QA WikiLeon Brocard2009-09-221-1/+1
|