File: set_linestr.t

package info (click to toggle)
libb-hooks-parser-perl 0.21-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 516 kB
  • sloc: ansic: 576; perl: 195; makefile: 3
file content (34 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use strict;
use warnings;
use Test::More tests => 2;
use B::Hooks::EndOfScope;
use B::Hooks::Parser;

BEGIN {
    B::Hooks::Parser::setup();
}

sub class (&) { }

# This would usually be a compilation error as class only expects one argument,
# but with the 'pass', there are two. After injecting a semicolon after the end
# of the block it becomes valid.
#
# We also insert lots of semicolons to make the resulting line larger than
# PL_linestr would usually be at this point. This is done to test the
# PL_linestr growing.

    class {
        BEGIN { on_scope_end {
            B::Hooks::Parser::inject(';' x 1024);
        } }
    }

pass;

# This checks that we can inject NULs.
no warnings "void";
BEGIN { B::Hooks::Parser::inject("is 'a', q\0a\0;"); }
'b';

1;