Skip to content

Commit

Permalink
Use Perl 6 heredocs and add a test for using single quotes in PL/Perl…
Browse files Browse the repository at this point in the history
…6 procedures
  • Loading branch information
leto committed Jun 29, 2010
1 parent 4e7500d commit 049b799
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plperl6.pir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.sub run
.param string code
$S0 = "my $r = eval 'sub {"
$S1 = "}'; $r.()"
$S0 = "my $r = eval q<<<\nsub {"
$S1 = "}\n>>>; $r.()"
code = $S0 . code
code .= $S1
load_bytecode 'dumper.pbc'
Expand Down
5 changes: 4 additions & 1 deletion t/sql/plperl6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BEGIN;
\i plparrot.sql

-- Plan the tests.
SELECT plan(4);
SELECT plan(5);

CREATE FUNCTION test_void_plperl6(integer) RETURNS void AS $$ Nil $$ LANGUAGE plperl6;

Expand All @@ -25,10 +25,13 @@ CREATE FUNCTION test_float_plperl6(integer) RETURNS float AS $$ 5.0 $$ LANGUAGE

CREATE FUNCTION test_string_plperl6() RETURNS varchar AS $$ "rakudo" $$ LANGUAGE plperl6;

CREATE FUNCTION test_singlequote_plperl6() RETURNS varchar AS $$ 'rakudo*' $$ LANGUAGE plperl6;

select is(test_int_plperl6(89),42,'Return an integer from PL/Perl6');
select is(test_void_plperl6(42)::text,''::text,'Return nothing from PL/Perl6');
select is(test_float_plperl6(2), 5.0::float,'Return a float from PL/Perl6');
select is(test_string_plperl6(), 'rakudo','Return a varchar from PL/Perl6');
select is(test_singlequote_plperl6(), 'rakudo*','Use a single quote in a PL/Perl6 procedure');

-- Finish the tests and clean up.
SELECT * FROM finish();
Expand Down

0 comments on commit 049b799

Please sign in to comment.