~ubuntu-branches/ubuntu/vivid/libcontextual-return-perl/vivid

« back to all changes in this revision

Viewing changes to t/method.t

  • Committer: Bazaar Package Importer
  • Author(s): Salvatore Bonaccorso, gregor herrmann, Salvatore Bonaccorso
  • Date: 2010-06-26 13:35:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100626133503-psljj2cm3p2yvb5e
Tags: 0.003001-1
[ gregor herrmann ]
* debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
  field (source stanza); Homepage field (source stanza). Removed: XS-
  Vcs-Svn fields.
* debian/watch: use dist-based URL.
* Refresh debian/rules, no functional changes, except: don't create
  .packlist any more.
* Set Standards-Version to 3.8.0 (no changes).
* Set debhelper compatibility level to 5.
* debian/control: change my email address.
* Move libmodule-build-perl from Build-Depends-Indep to Build-Depends.
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
  (source stanza).

[ Salvatore Bonaccorso ]
* New upstream release 
* Add myself to Uploaders. 
* Bump compat level to 8. Bump versioned debhelper Build-Depends on
  (>= 7.9.1) for compat level 8 support.
* debian/control:
  - Add Build-Depends on perl (>= 5.10) | libmodule-build-perl to have
    Module::Build available.
  - Change (Build-)Depends(-Indep) on libversion-perl to alternate 
    (Build-)Depends(-Indep) on perl (>= 5.10) | libversion- perl.
* debian/rules: Simplify to a tiny debian/rules makefile.
* Convert to '3.0 (quilt)' source package format.
* Refresh debian/copyright to revision 135 of format-specification in
  DEP5 for machine-readable copyright file.
* Bump Standards-Version to 3.8.4.
* Add lintian overrides for debhelper dependency and compat level 8
  lintian warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use Contextual::Return;
 
2
use Test::More 'no_plan';
 
3
use strict;
 
4
 
 
5
sub foo_with_default_method {
 
6
    return
 
7
        METHOD {
 
8
            bar           => sub { 'bar method called'     },
 
9
            qr/ba(.)/     => sub { $1 . ' method called'   },
 
10
            ['qux','dux'] => sub { "$_ method called"      },
 
11
            qr/.*/        => sub { 'DEFAULT method called' },
 
12
        }
 
13
        DEFAULT { 'DEFAULT value' }
 
14
}
 
15
 
 
16
is foo_with_default_method()->bar, 'bar method called',     'bar method';
 
17
is foo_with_default_method()->baz, 'z method called',       'baz method';
 
18
is foo_with_default_method()->qux, 'qux method called',     'qux method';
 
19
is foo_with_default_method()->dux, 'dux method called',     'dux method';
 
20
is foo_with_default_method()->jax, 'DEFAULT method called', 'DEFAULT method';
 
21
is foo_with_default_method()     , 'DEFAULT value',         'DEFAULT';
 
22
 
 
23
 
 
24
sub foo_with_method_and_obj {
 
25
    return
 
26
        METHOD {
 
27
            bar => sub { 'bar method called' },
 
28
        }
 
29
        OBJREF {
 
30
            bless {}, 'Bar';
 
31
        }
 
32
        DEFAULT { 'DEFAULT value' }
 
33
}
 
34
 
 
35
is foo_with_method_and_obj()->bar, 'bar method called',     'bar method called';
 
36
is foo_with_method_and_obj()->baz, 'Bar::baz',              'OBJREF method called';
 
37
is foo_with_method_and_obj()     , 'DEFAULT value',         'DEFAULT value';
 
38
 
 
39
 
 
40
 
 
41
 
 
42
package Bar;
 
43
 
 
44
sub baz { "Bar::baz" }