File: IgnoreWantarray.t

package info (click to toggle)
libdbix-class-helpers-perl 2.037000-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,012 kB
  • sloc: perl: 5,056; sql: 547; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 739 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
25
26
27
28
29
30
#!perl

use strict;
use warnings;

use lib 't/lib';
use Test::More;
use Test::Fatal;

use TestSchema;
TestSchema::ResultSet->load_components('Helper::ResultSet::IgnoreWantarray');

my $schema = TestSchema->deploy_or_connect();
$schema->prepopulate;

my ($rs) = $schema->resultset('Foo')->search;
my ($rs2) = $schema->resultset('Bar')->search;
my ($rs3) = $schema->resultset('Foo')->first->bars;
my ($rs4) = $schema->resultset('Bar')->first->foos;

isa_ok $rs, 'DBIx::Class::ResultSet';
isa_ok $rs2, 'DBIx::Class::ResultSet';
isa_ok $rs3, 'DBIx::Class::ResultSet';
isa_ok $rs4, 'DBIx::Class::ResultSet';

like(exception {
   $schema->resultset('Bar')->search
}, qr/search is \*not\* a mutator/, 'correctly die in void ctx');

done_testing;