File: pl_perl.t

package info (click to toggle)
libsql-splitstatement-perl 1.00023-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 484 kB
  • sloc: perl: 3,384; sql: 1,478; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 630 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;

use SQL::SplitStatement;

use Test::More tests => 1;
use Test::Differences;

my $sql_code = <<'SQL';
CREATE FUNCTION funcname (argument-types) RETURNS return-type AS $perl$
    # PL/Perl function body
    $arg->{things} = 'stuff';
$perl$ LANGUAGE plperl;
SQL

my $splitter = SQL::SplitStatement->new;
my @statements = $splitter->split( $sql_code );

eq_or_diff "$statements[-1]\n", <<'DONERIGHT', 'does not strip dollar quoted delimeters';
CREATE FUNCTION funcname (argument-types) RETURNS return-type AS $perl$
    # PL/Perl function body
    $arg->{things} = 'stuff';
$perl$ LANGUAGE plperl
DONERIGHT