~ubuntu-branches/ubuntu/trusty/libtest-roo-perl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/multi.t

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2014-01-14 19:25:11 UTC
  • Revision ID: package-import@ubuntu.com-20140114192511-9ycl4dc1zgamfnek
Tags: upstream-1.002
ImportĀ upstreamĀ versionĀ 1.002

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use 5.008001;
 
2
 
 
3
package MyTest;
 
4
use Test::Roo;
 
5
 
 
6
has phrase => (
 
7
    is       => 'ro',
 
8
    required => 1,
 
9
);
 
10
 
 
11
has regex => (
 
12
    is      => 'ro',
 
13
    default => sub { qr/world/i },
 
14
);
 
15
 
 
16
sub _build_description {
 
17
    return shift->phrase;
 
18
}
 
19
 
 
20
test try_me => sub {
 
21
    my $self = shift;
 
22
    like( $self->phrase, $self->regex, "phrase matched regex" );
 
23
};
 
24
 
 
25
package main;
 
26
use strictures;
 
27
use Test::More;
 
28
 
 
29
my @phrases = ( 'hello world', 'goodbye world', );
 
30
 
 
31
for my $p (@phrases) {
 
32
    MyTest->run_tests( { phrase => $p } );
 
33
}
 
34
 
 
35
done_testing;
 
36
 
 
37
#
 
38
# This file is part of Test-Roo
 
39
#
 
40
# This software is Copyright (c) 2013 by David Golden.
 
41
#
 
42
# This is free software, licensed under:
 
43
#
 
44
#   The Apache License, Version 2.0, January 2004
 
45
#
 
46
# vim: ts=4 sts=4 sw=4 et: