summaryrefslogtreecommitdiff
path: root/t
Commit message (Collapse)AuthorAgeFilesLines
* fully test package-version-block syntaxZefram2010-05-201-14/+21
| | | | | | Extend the exhaustive package-version tests in t/op/packagev.t to test each case using package-block syntax in addition to the package-declaration syntax.
* additional tests for package block syntaxZefram2010-05-201-20/+72
| | | | | | Test that __PACKAGE__ propagates into string eval correctly. Test that __LINE__ is correct. Test that goto into and out of package blocks works correctly.
* fix SEGV with eval("package Foo {")Zefram2010-05-201-1/+4
| | | | | | OPs relating to the package name and version were subject to double freeing during error recovery from an incomplete package block. Fixed by using the op_latefree mechanism to shift the op free time.
* support "package Foo { ... }"Zefram2010-05-201-0/+37
| | | | | | Package block syntax limits the scope of the package declaration to the attached block. It's cleaner than requiring the declaration to come inside the block.
* Merge branch 'vincent/rvalue_stmt_given' into bleadVincent Pit2010-05-191-1/+133
|\
| * Make given() statements return the last evaluated expressionVincent Pit2010-01-031-1/+133
| |
* | Fix groups.t test on AIXRainer Tammer2010-05-181-1/+2
| | | | | | | | 'id -a' doesn't work, so try it without the -a if that fails.
* | further fix for RT #23810David Mitchell2010-05-181-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | The fix for #23810, 27e904532594b7fb, introduced a regression, spotted by Nicholas as RT #75146. Basically, in S_doeval() if the yyparse() fails due to dying (rather than just bailing out with with a syntax error, say), then the topmost EVAL context will have been popped. My improved error handling code mostly understood the difference, but forgot that in the die case, PL_eval_root will have been restored to its previous value by the CX pop, and thus its value shouldn't be messed with.
* | use the correct format codes in warnings from gmtime/localtimeTony Cook2010-05-171-1/+42
| |
* | PATCH: Clean up EBCDIC handling of \cXKarl Williamson2010-05-171-1/+0
| | | | | | | | | | | | | | | | | | | | The function perl_ebcdic_control() is unnecessary, as the toCTRL macro that calls it can be changed to just map EBCDIC to ASCII first, and then doing the normal procedure. This means that EBCDIC and ASCII will no longer diverge. Currently, EBCIDIC gives a syntax error for inputs outside its domain, whereas the ASCII version accepts some of them.
* | [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.
* | Return 0 (with a warning) for sprintf("%.0g") and sprintf("%.0f")Nicholas Clark2010-05-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is special case code in the sprintf implementation, for simple %f and %g formats, conditionally compiled in only when NVs are doubles. Under long doubles, these are handled by the general purpose code, which always returns 0 if the argument is missing. Note that sprintf(" %.0g"), ie a leading space, sufficient to bypass the special case code, would return the string " 0". The special case code used to return an empty string, meaning that the behaviour of sprintf("%.0g") and sprintf("%.0f") was inconsistent between a perl built with doubles, and a perl with long doubles, and the behaviour of sprintf("%.0g") and sprintf(" %.0g") was inconsistent. 5b98cd54dff3b163 fixed #62874 - the special case code did not warn, but changed behaviour to return 0. d347ad18ecf3da70 undid the behaviour change, viewing it as a regression. However, the tests added in 5b98cd54dff3b163 expose the inconsistency in behaviour between doubles and long doubles. There should be no inconsistency, hence the only logically consistent conclusion is that the special case implementation was wrong - it cannot give results inconsistent with the general code. Hence this commit changes it to return 0 (with a warning). This is achieved by simply skipping the special case code, if there are insufficient arguments.
* | separate the 0755 from the . $TAINT0. this silences the warning "Dot after ↵Richard Soderberg2010-05-101-1/+1
| | | | | | | | octal literal is concatenation".
* | PATCH [perl #74978] dot after } breaks \N{}Karl Williamson2010-05-081-1/+7
| | | | | | | | | | | | | | | | | | The problem is that a dot can come between the braces in \N{foo.bar}, but when searching for it, I didn't stop looking at the right brace, so it generated an error inappropriately. This is essentially a minimum patch; efficiency could be improved slightly with a little more work.
* | Note in comment that many \N{...} tests won't work hereKarl Williamson2010-05-081-0/+2
| |
* | Comment where to find file's formatKarl Williamson2010-05-081-1/+1
| |
* | RT #34604 didn't honour tied overloaded valuesDavid Mitchell2010-05-081-1/+30
| | | | | | | | | | | | A tied hash lookup could return an overloaded object but sort wouldn't notice that it was overloaded because it checked for overload before doing mg_get().
* | Make t/op/sprintf.t test multiple warningsVincent Pit2010-05-061-4/+4
| |
* | Stop returning 0 for sprintf("%.0g")Vincent Pit2010-05-061-2/+4
| | | | | | | | | | | | And also from throwing two "Missing argument" warnings for this construct. This was a regression introduced by 5b98cd54dff3b16344eab33ce6b09fb6fb1b89c2.
* | Really test special sprintf formatsVincent Pit2010-05-061-1/+2
| |
* | Make sv_vcatpvfn() complain when special formats "%s" and "%.0f" can't find ↵Vincent Pit2010-05-061-0/+4
| | | | | | | | | | | | their argument This fixes [RT #62874] : printf does not print a warning when a lone %s conversion is used
* | 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-053-40/+4
| | | | | | | | | | | | | | This reverts commit 1183a10042af0734ee65e252f15bd820b7bbe686. Zefram asked me to revert this as he's going to be doing something more pluggable
* | make 'local $tied' untiedDavid Mitchell2010-05-041-1/+28
| | | | | | | | When localising a tied scalar, don't make the scalar tied
* | make local @tied, %tied, untiedDavid Mitchell2010-05-041-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix for RT #7938, #7939: when localising an array or hash, don't make the new aggregate tied. The old behaviour of { local @tied; ... } was equivalent to: { my $saved = \@tied; *tied = []; tied(@tied) = tied(@$saved) # if tied() were an lvalue function ... *tied = $saved; } This patch simply removes the 'tied(@tied) = ...' step
* | Merge remote branch 'zefram/zefram/reliable_exception' into bleadRafael Garcia-Suarez2010-05-045-0/+254
|\ \ | | | | | | | | | | | | Conflicts: pp_ctl.c
| * | bring G_KEEPERR back to the realm of sanityZefram2010-04-232-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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].
| * | SV-based interfaces for dieing and warningZefram2010-04-231-0/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New functions croak_sv(), die_sv(), mess_sv(), and warn_sv(), each act much like their _sv-less counterparts, but take a single SV argument instead of sprintf-like format and args. They will accept RVs, passing them through as such. This means there's no more need to clobber ERRSV in order to throw a structured exception. pp_warn() and pp_die() are rewritten to use the _sv interfaces. This fixes part of [perl #74538]. It also means that a structured warning object will be passed through to $SIG{__WARN__} instead of being stringified, thus bringing warn in line with die with respect to structured exception objects. The new functions and their existing counterparts are all fully documented.
| * | make die reliably hand error to post-eval codeZefram2010-04-212-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | Put the exception into $@ last thing before longjmping to the op following the eval block, where previously it went into $@ before unwinding the stack. This change means that the exception is not liable to be lost by $@ being clobbered by destructors, cleanup code, or restoration after "local $@". The code running immediately after eval can now rely on $@ accurately indicating the exception status of the eval.
* | | tweak "0x123.456" deprecationZefram2010-05-033-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | tries: don't allocate memory at runtimeDavid Mitchell2010-05-031-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an indirect fix for [perl #74484] Regex causing exponential runtime+mem usage The trie runtime code was doing more SAVETMPS than FREETMPS and was thus growing a large tmps stack on heavy backtracking. Rather than fixing this directly, I rewrote part of the trie code so that it no longer needs to allocate memory in S_regmatch (it still does in find_byclass()). The basic issue is that multiple branches in the trie may trigger an accept state; for example: "abcd" =~ /xyz/abcd.*X|ab.*Y|/ here, words (branches) 2 and 3 are accept states. The original approach was, at run time, to create a list of accepted word numbers and the character positions of the end of each of those words. Then run the rest of the pattern for each word in the list in turn (in word index order). This requires memory for the list to be allocated and freed. The new approach involves creating extra info at compile time; in particular, for each word, a pointer to the previous accepted word (if any) in the state tree. For example for the above pattern, part of the state tree may be q b c d 1 -> 2 -> 3 -> 4 -> 5 (#3) (#2) (e.g. at state 1, if the next char is 'a', we transition to state 2). Here, state 3 is an accept state with word #3, and 5 is an accept state with word #2. So we build a table indexed by word number, which has wordinfo[2] = 3, wordinfo[3] = 0, thus building the word chain 2->3->0. At run time we run the trie to completion, and remember the word associated with the longest accept state (word #2 above). Then by following back the chain of .prev fields, we can produce a list of all accepting words. We then iteratively find the smallest-numbered (ie LH-most) word in the chain, and run with it. On failure and backtrack, we find the next-smallest and so on. Since we are no longer recording the end-position of each word in the string, we have to recalculate this for each backtrack. We initially record the end-position of the shortest accepting word, and given that we know the length of each word, we can calculate the new position each time as an offset from that first word. Depending on unicode and folding, that calculation can be cheap or expensive. This algorithm is optimised for the typical case where there are a small number (<= 2) accepting states. This patch creates a new compile-time array, trie->wordinfo[], indexed by word number, which contains relevant info about each word. This also supersedes the old trie->newword[] array, whose function of recording "overspills" of multiple words per accept state, is now handled as part of the wordinfo[].prev chain.
* | | RT#73814 - unpack() didn't handle scalar context correctly for %32H and %32uTony Cook2010-04-301-1/+9
| | | | | | | | | | | | | | | | | | | | | split() would crash because the third item on the stack wasn't the regular expression it expected. unpack("%2H", ...) would return both the unpacked result and the checksum on the stack, similarly for unpack("%2u", ...).
* | | Globs that are in symbol table can be un-globbedLubomir Rintel (GoodData)2010-04-261-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a symbol table entry is undefined when a glob is assigned into it, it gets a FAKE flag which makes it possible to be downgraded when non-glob is subsequently assigned into it. It doesn't really matter, until we decide to localize it -- it wouldn't be possible to restore its GP upon context return if it changed type, therefore we must not do that. This patch turns off FAKE flag when localizing a GV and restores it when the context is left. A test case is included.
* | | Deal with "\c{", and its kinKarl Williamson2010-04-262-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | make regen is needed This patch forbids non-ascii following the "\c". It also terminates for "\c{" with a message to contact p5p if there is need for continuing its current definition. And if the character following the "\c" causes the result to not be a control character, a warning is issued. This is currently 'deprecated', which by default is turned on. This can easily be changed later. This patch is the initial patch. It does not do any fancy showing the context where the problematic construct occurs. This can be added later. It gathers the 3 occurrences of evaluating \c and puts them in one common routine.
* | | Don't use Test::More in t/op/* testsRafael Garcia-Suarez2010-04-261-4/+10
| | |
* | | Fix utf8::is_utf8 to respect GMAGIC (e.g. $1)gfx2010-04-251-0/+19
| | |
* | | avoid multiple FETCHesDavid Mitchell2010-04-251-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix 2d961f6deff7 for RT #5475 included a mechanism for the early calling of get magic on something like $tied[0]; so that even though the element is used in void context, we still call FETCH. Some people seem to rely on this. However, the call to mg_get() didn't distinguish between a tiedelem member retrieved from a tied array/hash, and a tiedscalar element retrieved from a plain array/hash. In the latter case, the S_GSKIP protection mechanism doesn't apply and a simple $foo = $h{tiedelem} generated two calls to FETCH. Fix this by only calling mg_get() on the element if it came from a *tied* array/hash. A side-effect of this fix is that the following no longer calls FETCH: my @plain_array; tie $plain_array[0], ....; # element 0 is now a tied scalar $plain_array[0]; # void context: no longer calls FETCH. This required one test in op/tie.t to be fixed up, but in general I think this is a reasonable compromise.
* | | t/mro/vulcan* fixesArkturuz2010-04-232-2/+2
| | | | | | | | | | | | | | | It seems that Dylan Reference Book has been relocated, so included is the small patch for the vulcan_* test files with the new link.
* | | 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
| | |
* | | time() resolution is full secondsJan Dubois2010-04-221-2/+4
| | | | | | | | | | | | | | | | | | So any fudging in the timing needs to be at least 1 second to have any effect. Upped the total $sleep value to 4 (on Windows) to make sure at least 3 seconds have passed. Amends commit 0ebb4f0.
* | | Consistently use OP_DESC instead of OP_NAME in error messagesRafael Garcia-Suarez2010-04-221-1/+1
| | | | | | | | | | | | | | | | | | | | | This solves bug: [perl #74572] chop dies with error about schop This is not backwards-compatible, as some error messages can change, as seen by the required change to t/op/sprintf2.t.
* | | Add fudge to timing checks on WindowsJan Dubois2010-04-211-2/+7
| | | | | | | | | | | | | | | | | | | | | sleep() time on Win32 may be rounded down to multiple of the clock tick interval. http://www.nntp.perl.org/group/perl.perl5.porters/2010/03/msg157878.html
* | | follow up fix for fd69380d5d5b95ef16e2521cf4251b34ee0ce151David Mitchell2010-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | The original fix for tied elements losing magic had a bug that was masked by a bool casting issue. Once the casting was fixed, the bug surfaced: elements of @+ lost their values when returned from a sub. By removing the TEMP flag from the regdatum PVLV, we force it to be copied when returned.
* | | add TODO test for #74484 trie leakDavid Mitchell2010-04-211-1/+29
|/ / | | | | | | | | Also add leak_expr function to svleak.t to test an expression for leakage rather than a whole sub
* | Dispatch signals in infinite loops such as 1 while 1;Nicholas Clark2010-04-171-0/+38
| | | | | | | | | | | | | | | | | | With the move of PERL_ASYNC_CHECK() out from the runloop to control ops, infinite loops became truely infinite, as their optree has no control ops. Hence add a PERL_ASYNC_CHECK() to pp_unstack to ensure signals will be dispatched. Bug noticed by Jerry Hedden.
* | Fix RT #74290 - regression for labels immediately before string evals.Nicholas Clark2010-04-171-1/+10
| | | | | | | | | | | | Fix location identified by Father Chrysostomos, who also offered a patch, but this patch is more efficient, as it avoids any allocation. Test code based on his test example.
* | Set the legacy process name with prctl() on assignment to $0 on LinuxÆvar Arnfjörð Bjarmason2010-04-151-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Ever since perl 4.000 we've only set the POSIX process name via argv[0]. Unfortunately on Linux the POSIX name isn't used by utilities like top(1), ps(1) and killall(1). Now when we set C<$0 = "hello"> both C<qx[ps h $$]> (POSIX) and C<qx[ps hc $$]> (legacy) will say "hello", instead of the latter being "perl" as was previously the case. See also the March 9 2010 thread "Why doesn't assignment to $0 on Linux also call prctl()?" on perl5-porters.
* | mark two magic.t tests as TODODavid Mitchell2010-04-151-0/+1
| | | | | | | | | | fixing a bool cast bug exposes a hidden bug in @+ scope. Mark as TODO for now.