summaryrefslogtreecommitdiff
path: root/t/run
Commit message (Collapse)AuthorAgeFilesLines
* Refactor t/run/switcha.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-201-3/+6
|
* [perl #105922] Allow any string before ->methFather Chrysostomos2012-09-201-1/+1
| | | | | | | | | | | | | | | | | | | The rules for filtering out what do not look like package names are not logical and disallow valid things like "::main", while allowing q"_#@*$!@*^(". This commit simply lets any non-empty string be used as a package name. If it is a typo, you’ll get an error anyway. This allows autobox-style calls like "3foo"->CORE::uc, or even "3foo"->uc if you set up @ISA first. I made an exception for the empty string because it messes up caches somehow and causes subsequent method calls all to be called on the main package. I haven’t looked into that yet. I don’t know whether it’s worth it. The changes to the tests in cpan/Test-Simple have been submit- ted upstream.
* t/run/mad.t: Avoid %ENV assignmentFather Chrysostomos2012-09-171-2/+2
| | | | I see no skip on VMS, so use an %ENV localisation that it supports.
* g++ + mad fails t/run/mad.tFather Chrysostomos2012-09-171-6/+6
| | | | | | | | | | | | | | | | | | | | For some reason, g++ causes $^X to have a relative path when called with one, whereas gcc causes it to have an absolute path: g++: $ ./perl -le 'print $^X' ./perl gcc: $ ./perl -le 'print $^X' /Users/sprout/Perl/perl.git-copy/perl (This is on 32-bit darwin.) This affects mad.t’s ability to find the current perl interpreter after a chdir.
* Refactor t/run/noswitch.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-161-5/+9
|
* Refactor t/run/switchF.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-161-3/+8
|
* Refactor t/run/switchn.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-161-3/+7
|
* Refactor t/run/switch0.t to use test.pl instead of making TAP by hand.Colin Kuskie2012-09-141-2/+10
|
* "loading-file" and "loaded-file" DTrace probesShawn M Moore2012-08-282-1/+21
|
* "op-entry" DTrace probeShawn M Moore2012-08-281-2/+22
|
* ignore PERL_XMLDUMP when taintingTony Cook2012-08-081-0/+46
| | | | | | In theory this is a security issue, but from discussion on the security list that the system perl (or the perl used for anything critical) is wildly unlikely to have been built with -Dmad.
* fresh_perl.t: Skip #112312 tests on miniperlFather Chrysostomos2012-06-291-2/+2
| | | | They require attributes.pm.
* Test perl #112312, crash on syntax errorFather Chrysostomos2012-06-291-0/+52
| | | | | | | | | | | | | | | | I am having difficulty getting these tests to fail. They crash when run standalone, but always pass when run via fresh_perl.t. Hopefully, they will fail somewhere. :-) Yes, fresh_perl.t does begin with this: # ** DO NOT ADD ANY MORE TESTS HERE ** But t/comp/parser.t does not (and should not) use test.pl, so it is very hard to test something like this. Putting it here seemed slightly better than putting it in its own file.
* warn on -i with no input files given [perl #113410]Jesse Luehrs2012-06-261-1/+21
|
* Mostly complete fix for literal /(?{..})/ blocksDavid Mitchell2012-06-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the way that code blocks in patterns are parsed and executed, especially as regards lexical and scoping behaviour. (Note that this fix only applies to literal code blocks appearing within patterns: run-time patterns, and literals within qr//, are still done the old broken way for now). This change means that for literal /(?{..})/ and /(??{..})/: * the code block is now fully parsed in the same pass as the surrounding code, which means that the compiler no longer just does a simplistic count of balancing {} to find the limits of the code block; i.e. stuff like /(?{ $x = "{" })/ now works (in the same way that subscripts in double quoted strings always have: "$a{'{'}" ) * Error and warning messages will now appear to emanate from the main body rather than an re_eval; e.g. the output from #!/usr/bin/perl /(?{ warn "boo" })/ has changed from boo at (re_eval 1) line 1. to boo at /tmp/p line 2. * scope and closures now behave as you might expect; for example for my $x (qw(a b c)) { "" =~ /(?{ print $x })/ } now prints "abc" rather than "" * with recursion, it now finds the lexical within the appropriate depth of pad: this code now prints "012" rather than "000": sub recurse { my ($n) = @_; return if $n > 2; "" =~ /^(?{print $n})/; recurse($n+1); } recurse(0); * an earlier fix that stopped 'my' declarations within code blocks causing crashes, required the accumulating of two SAVECOMPPADs on the stack for each iteration of the code block; this is no longer needed; * UNITCHECK blocks within literal code blocks are now run as part of the main body of code (run-time code blocks still trigger an immediate call to the UNITCHECK block though) This is all achieved by building upon the efforts of the commits which led up to this; those altered the parser to parse literal code blocks directly, but up until now those code blocks were discarded by Perl_pmruntime and the block re-compiled using the original re_eval mechanism. As of this commit, for the non-qr and non-runtime variants, those code blocks are no longer thrown away. Instead: * the LISTOP generated by the parser, which contains all the code blocks plus OP_CONSTs that collectively make up the literal pattern, is now stored in a new field in PMOPs, called op_code_list. For example in /A(?{BLOCK})C/, the listop stored in op_code_list looks like LIST PUSHMARK CONST['A'] NULL/special (aka a DO block) BLOCK CONST['(?{BLOCK})'] CONST['B'] * each of the code blocks has its last op set to null and is individually run through the peephole optimiser, so each one becomes a little self-contained block of code, rather than a list of blocks that run into each other; * then in re_op_compile(), we concatenate the list of CONSTs to produce a string to be compiled, but at the same time we note any DO blocks and note the start and end positions of the corresponding CONST['(?{BLOCK})']; * (if the current regex engine isn't the built-in perl one, then we just throw away the code blocks and pass the concatenated string to the engine) * then during regex compilation, whenever we encounter a '(?{', we see if it matches the index of one of the pre-compiled blocks, and if so, we store a pointer to that block in an 'l' data slot, and use the end index to skip over the text of the code body. Conversely, if the index doesn't match, then we know that it's a run-time pattern and (for now), compile it in the old way. * During execution, when an EVAL op is encountered, if data->what is 'l', then we just use the pad that was in effect when the pattern was called; i.e. we use the current pad slot of the currently executing CV that the pattern is embedded within.
* make re_evals be seen by the toker/parserDavid Mitchell2012-06-131-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a first step to making the handling of (/(?{...})/ more sane. But see the big proviso at the end. Currently a patten like /a(?{...})b/ is uninterpreted by the lexer and parser, and is instead passed as-is to the regex compiler, which is responsible for ensuring that the embedded perl code is extracted and compiled. The only thing the quoted string code in the lexer currently does is to skip nested matched {}'s, in order to get to end of the code block and restart looking for interpolated variables, \Q etc. This commit makes the lexer smarter. Consider the following pattern: /FOO(?{BLOCK})BAR$var/ This is currently tokenised as op_match ( op_const["FOO(?{BLOCK})BAR"] , $ "var" ) Instead, tokenise it as: op_match ( op_const["FOO"] , DO { BLOCK ; } , op_const["(?{BLOCK})"] , op_const["BAR"] , $ "var" ) This means that BLOCK is itself tokenised and parsed. We also insert a const into the stream to include the original source text of BLOCK so that it's available for stringifying qr's etc. Note that by allowing the lexer/parser direct access to BLOCK, we can now handle things like /(?{"{"})/ This mechanism is similar to the way something like "abc $a[foo(q(]))] def" is currently parsed: the double-quoted string handler in the lexer stops at $a[, the 'foo(q(]))' is treated as perl code, then at the end control is passed back to the string handler to handle the ' def'. This commit includes a new error message: Sequence (?{...}) not terminated with ')' since when control is passed back to the quoted-string handler, it expects to find the ')' as the next char. This new error mostly replaces the old Sequence (?{...}) not terminated or not {}-balanced in regex Big proviso: This commit updates toke.c to recognise the embedded code, but doesn't then do anything with it. The parser will pass both a compiled do block and a const for each embedded (?{..}), and Perl_pmruntime just throws away the do block and keeps the constant text instead which is passed to the regex compiler. So currently each code block gets compiled twice (!) with two sets of warnings etc. The next stage will be to pass these do blocks to the regex compiler. This commit is based on a patch I had originally worked up about 6 years ago and has been sitting bit-rotting ever since.
* Improve the tests for -xNicholas Clark2012-02-273-2/+21
| | | | | Test the error message generated when -x can't find a "#!perl" line. Test that this error message still appears when -x is used with -e.
* Improve the tests for the -n and -p switches.Nicholas Clark2012-02-272-4/+17
| | | | | | Verify that -p actually runs the code in the program body. Verify that -n doesn't implicitly print out the contents of $_. For both, verify that an END block runs after the implicit loop.
* Simplify platform specific code in t/run/cloexec.tNicholas Clark2012-02-271-6/+3
| | | | | | | | | | | | | Don't assign to two lexical variables, $Is_VMS and $Is_Win32, only to use them immediately for the same purpose - to skip the entire test. In turn, there's no need to conditionally set $quote to a value suitable for VMS or Win32, when neither OS ever runs the test. The code has been this way since the file was added by commit 742218b34f58f961 in Nov 2006. Hence I don't think that the vestigial $quote logic corresponds to pre-commit version that did run on these platforms. Instead I infer that it has come from t/op/exec.t, used as a template for running sub-scripts in a portable fashion.
* Test ‘Too late for -[Mm]’Father Chrysostomos2011-12-301-1/+5
|
* [perl #104288] Die with ‘Unrecognized switch’ on #! lineFather Chrysostomos2011-12-301-1/+15
| | | | | | | | | | | | | | | | | If a switch such as -x that cannot occur on the shebang line is used there, perl dies with ‘Can’t emulate...’. If an unrecognised switch is used on the command line, perl dies with ‘Unrecognized switch...’. It just happens to use the former error message for unrecognized switches on the shebang line, which can be confusing: $ perl -e '#!perl -G' Can't emulate -G on #! line at -e line 1. This commit changes it to output the same message as command-line switches for those that are unrecognised wherever they are used.
* test that version.pm does not clobber localeRicardo Signes2011-12-181-1/+31
|
* Fix pp_goto crash with orphaned GVFather Chrysostomos2011-11-181-1/+17
| | | | | a7999c089 inadvertently made pp_goto crash if the GV had no stash pointer.
* Make sure $DB::sub is callableFather Chrysostomos2011-11-181-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When DB::sub is about to be called (to handle a subroutine call under the debugger), $DB::sub is set to the name of the subroutine or a ref- erence to it. Sometimes $DB::sub is set to the name when the subroutine is not call- able under that name. That should not happen. This logic in util.c:Perl_get_db_sub decides whether a reference should be used: if ( svp && ((CvFLAGS(cv) & (CVf_ANON | CVf_CLONED)) || strEQ(GvNAME(gv), "END") || ((GvCV(gv) != cv) && /* Could be imported, and old sub redefined. */ !( (SvTYPE(*svp) == SVt_PVGV) && (GvCV((const GV *)*svp) == cv) && (gv = (GV *)*svp) ) ) )) { /* Use GV from the stack as a fallback. */ (That comment about using the GV from the stack as a fallback applies to the assignment to gv, but was mistakenly divorced from it in commit 3de9ffa12.) This logic (introduced in 71be2cbc7 [inseparable changes from perl5.003_13 to perl5.003_14] and integrated into blead in 491527d02) tries to find a GV that points to the CV, trying the CV’s own GV first, and falling back to what is on the stack. But it does not account for GVs that are not found under their names, which can hap- pen when a glob is copied and the original is undefined ($foo = *bar; undef *bar; &$foo) or when a stash element or package is deleted, such as via Symbol::delete_package. If the subroutine is not locatable under its own name or the name under which it was called (the name of the GV argument to entersub), then a reference should be passed. Otherwise a name that can access the sub should be passed. So this commit adds more (no, not more!) conditions to make sure the gv is actually reachable under its name before using a string. Since, for effiency, those conditions do not perform an actual symbol lookup, but simply look inside the GV’s stash, we can no longer rely on gv_efullname (or even gv_fullname), as the stash may have been moved around, but use HvENAME and construct the GV name ourselves.
* Restore VMS glob skip removed in 1bb8785a.Craig A. Berry2011-11-041-12/+19
| | | | | | | The test appears to be checking the handling of double quotes in File::Glob::csh_glob(), but on VMS, we're not using that, we're using Perl_vms_start_glob(). Perhaps the latter should do some quote removal as well.
* Rewrite csh_glob in C; fix two quoting bugsFather Chrysostomos2011-10-261-43/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit rewrites File::Glob::csh_glob (which implements perl’s default globbing behaviour) in C. This fixes a problem introduced by 0b0e6d70f. If there is an unmatched quotation mark, all attempts to parse the pattern are discarded and it is treated as a single token. Prior to 0b0e6d70f, whitespace was stripped from both ends in that case. As of 0b0e6d70f, it was only stripped from the beginning. This commit restores the pre-0b0e6d70f behaviour with unmatched quotes. It doesn’t take 'a"b\ ' into account (where the space is escaped), but that wasn’t handled properly before 0b0e6d70f, either. This also finishes making csh_glob consistent with regard to quota- tion marks. Commit 0b0e6d70f attempted to do that, but did not strip out medial quotation marks, as in a"b"c. Text::ParseWords does not provide an interface for stripping out quotation marks but leaving backslashes, which I tried to work around, not fully understanding the implications. Anyway, this new C implementation doesn’t use Text::ParseWords. The latter fix caused a test failure, but that test was there to make sure the behaviour didn’t change depending on whether File::Glob was loaded before the first mention of glob(). (In 5.6, loading File::Glob first would make perl revert to external csh glob, ironic- ally enough.) This commit modifies the test to test for sameness, rather than exact output. In fact, this change causes perl and miniperl to be consistent, and probably also causes glob to be more consistent across platforms (think of VMS). Another effect of the translation to C is that the Unicode Bug is fixed with regard to splitting patterns. The C code effectively does /\s/a now (which I believe is the only sane behaviour in this case), instead of treating the string differently depending on the UTF8 flag. The Unicode Bug is still present with regard to actual globbing. This commit introduces one regression. This code: undef %File::Glob::; glob("nometachars"); will no longer return anything, because csh_glob no longer holds a reference count on the $File::Glob::DEFAULT_FLAGS glob. Any code that does that is beyond crazy. The big advantage to this patch is speed. Something like ‘@files = <*>’ is 18% faster in a folder of 300 files. For smaller folders there should be an even more notable difference.
* Make switchC.t pass if the environment variable PERL_UNICODE contains "S"Rafael Garcia-Suarez2011-08-311-6/+11
| | | | | (actually doing so the quick way, by skipping the last test, that tests for -CS on the shebang line)
* Document and test the phase-change probeShawn M Moore2011-07-121-1/+63
|
* Load modules only after setting up @INCFlorian Ragwitz2011-07-121-3/+4
|
* New test file that exercises Perl's DTrace supportShawn M Moore2011-07-111-0/+94
|
* Move the test for 078c425b721ea35d from fresh_perl.t to pat_rt_report.tNicholas Clark2011-03-071-17/+0
| | | | | | It happens to be the only test in fresh_perl.t that skips on miniperl. pat_rt_report.t automatically skips on miniperl, and isn't exclusively for bugs reported via RT.
* Add skip_all_without_config() to test.pl, and use it in 6 tests.Nicholas Clark2011-03-072-10/+3
| | | | | This abstracts out the common idiom of loading Config, checking if a particular key is true, and if not implementing a "skip all" with an appropriate reason.
* Add skip_all_without_perlio() to test.pl, and use it in 8 tests.Nicholas Clark2011-03-071-4/+1
| | | | | It's a common idiom in the tests. This makes it easier to find, read, and remove.
* Refactor 6 tests in t/op and t/run to use skip_all_if_miniperl().Nicholas Clark2011-03-071-7/+3
|
* In t/ avoid using File::Spec for paths only used by Perl.Nicholas Clark2011-03-061-4/+3
| | | | | | All platforms Perl builds on can already support Unix-style paths (given that make_ext.pl is using them). This makes 7 more tests pass under minitest, which doesn't build File::Spec, because it's part of an XS module.
* In switchI.t, use nolib => 1 to make the tests pass on miniperl once more.Nicholas Clark2011-02-211-5/+2
| | | | | | | | | fresh_perl_is() defaults to automatically prefixing the test perl's arguments with -I../lib, which (now) causes miniperl to find ../lib/buildcustomize.pl, which (when found and run) resets @INC, perturbing the tests. Suppressing the automatic addition of -I../lib avoids these problems. Also, fold together the two adjacent BEGIN blocks at the start of the script.
* In runenv.t, don't automatically add -I../lib to the test program's arguments.Nicholas Clark2011-02-211-14/+11
| | | | | | | | | | Instead, add -I../lib explicitly to the program's arguments when needed. This makes the test pass with miniperl, and simplifies the later tests which inspect the entirety of @INC. miniperl will have been failing since 5e4c4c91bd52a48d, because it now loads $INC[0]/buildcustomize.pl if present, resetting @INC, and always providing -I../lib will cause it to find the buildcustomize.pl script.
* Refactor t/run/runenv.t to use lexical file handles.Nicholas Clark2011-02-211-12/+13
| | | | Also print out $! in open failure diagnostics.
* In runenv.t, inline runperl() into try(), its only caller.Nicholas Clark2011-02-211-33/+9
| | | | | | | | | | | | d5226c4c8f9a2932e broke runperl_and_capture() out from runperl(), but didn't notice that there was only one caller for runperl(). Change try() to use is() for testing each of STDOUT and STDERR, instead of an explicit test, explicit diagnostics, and a summary to ok(). This increases the tests run, hence the plan needs changing. Also inline it_didnt_work() into runperl_and_capture(), and remove the END block that deletes the temporary files, which has been vestigial since 2d90ac9586ffb5c7 converted runenv.t to use test.pl's tmpfile().
* Fix typos (spelling errors) in t/*.Peter J. Acklam) (via RT2011-01-071-1/+1
| | | | | | | # New Ticket Created by (Peter J. Acklam) # Please include the string: [perl #81916] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81916 >
* Replaced '1 while unlink' with 'unlink_all' in t/run/switches.tBrad Gilbert2010-12-081-2/+2
|
* Extend -d:foo=bar to make -d:-foo expand to C<no foo>, consistent with -M-fooNicholas Clark2010-11-251-1/+7
|
* Adjust t/run/switchd-78586.t to work under t/TEST and t/harness.Nicholas Clark2010-11-111-1/+7
|
* Test for [perl #78586]Tim Bunce2010-11-111-0/+40
|
* Document that the -Ci, -Co, and -CD options have file scopeNiko Tyni2010-11-051-1/+16
| | | | | | While the other -C settings are global, "i" and "o" only affect subsequent open() calls in the current file. Document this and add two tests to make sure the documented behaviour doesn't change accidentally.
* Don't fold constants in sprintf() if locales are usedNiko Tyni2010-10-271-1/+14
| | | | | Commit c427f4d2d4575fbc8a5190932fe321136c7597b3 in 5.10.1 made sprintf() ignore LC_NUMERIC for numeric constants.
* LC_NUMERIC documentation updates + testsNiko Tyni2010-10-271-5/+88
| | | | | | | | | | | | | | | | Most of the confusion around LC_NUMERIC was fixed with commits 7e4353e96785be675a69a6886d154405dbfdc124 and 2095dafae09cfface71d4202b3188926ea0ccc1c but two errors remain: - the early parts of perllocale.pod still say printf() uses LC_NUMERIC with just 'use locale' when actually a POSIX::setlocale() call is also needed - format() hasn't used LC_NUMERIC unconditionally since 5.005_03 (commit 097ee67dff1c60f201bc09435bc6eaeeafcd8123). Update the documentation and test the claims in t/run/locale.t.
* Refactor LC_NUMERIC test out of t/run/fresh_perl.tNiko Tyni2010-10-272-36/+50
| | | | | | Neither lib/locale.t nor t/run/fresh_perl.t should be used for new tests, so take the locale related tests and the setup code from fresh_perl.t to make ground for more.
* refactor and regularise label/statement grammarZefram2010-10-251-2/+2
| | | | | | | | | | | | | | | | | | | | Refactoring of the grammar around statements. New production <barestmt> encompasses a statement without label. It includes all statement types, including declarations, with no unnecessary intermediate non-terminals. It generates an op tree for the statement's content, with no leading state op. The <fullstmt> production has just one rule, consisting of optional label followed by <barestmt>. It puts a state op on the front of the statement's content ops. To support the regular statement op structure, the op sequence for for(;;) loops no longer has a second state op between the initialisation and the loop. Instead, the unstack op type is slightly adapted to achieve the stack clearing without a state op. The newFOROP() constructor function no longer generates a state op, that now being the job of the <fullstmt> production. Consequently it no longer takes a parameter stating what label is to go in the state op. This brings it in line with the other op constructors.
* [perl #48332] Debugger corrupts symbol table mungingFather Chrysostomos2010-09-301-2/+17
| | | | | | | | This reverts commit 92adfbd49af0758bcc9a198cf2df2bd78c4176b9, which removed a necessary assignment for the sake of consting. In doing so, it allows subroutine redefinition to work properly again in the debugger.