]> git.vpit.fr Git - perl/modules/Scope-Context.git/blob - t/10-basic.t
Update VPIT::TestHelpers to 15e8aee3
[perl/modules/Scope-Context.git] / t / 10-basic.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 11;
7
8 use Scope::Context;
9
10 for my $method (qw<new here>) {
11  local $@;
12  eval {
13   my $here = Scope::Context->$method;
14   isa_ok $here, 'Scope::Context', "$method return value isa Scope::Context";
15  };
16  is $@, '', "creating a new object with ->$method does not croak";
17 }
18
19 {
20  local $@;
21  eval {
22   my $here      = Scope::Context->new;
23   my $also_here = Scope::Context->new($here->cxt);
24   isa_ok $here,      'Scope::Context', '$here isa Scope::Context';
25   isa_ok $also_here, 'Scope::Context', '$also_here isa Scope::Context';
26  };
27  is $@, '', 'creating a new object from a given context does not croak';
28 }
29
30 for my $method (qw<new here>) {
31  local $@;
32  eval {
33   my $here = $Scope::Context::{$method}->();
34   isa_ok $here, 'Scope::Context', "$method return value isa Scope::Context";
35  };
36  is $@, '', "creating a new object with Scope::Context::$method does not croak";
37 }