File: 006_install_subs.t

package info (click to toggle)
libeval-context-perl 0.09.11-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 292 kB
  • ctags: 23
  • sloc: perl: 762; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 652 bytes parent folder | download | duplicates (6)
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
31
# test

use strict ;
use warnings ;

use Data::TreeDumper ;

use Test::Exception ;
use Test::Warn;
use Test::NoWarnings qw(had_no_warnings);

use Test::More 'no_plan';
use Test::Block qw($Plan);

use Eval::Context ; 

{
local $Plan = {'install subs' => 2} ;

{
my $get_117 = sub{117} ;
my $result = new Eval::Context(PACKAGE => 'TEST')->eval(CODE => 'get_117() ;', INSTALL_SUBS => {get_117 => $get_117}) ;

is($result, 117, 'sub pushed into context') ;
}
	
throws_ok
	{
	my $context = new Eval::Context(INSTALL_SUBS => {get_117 => 'error'})->eval(CODE => '') ;
	} qr/'get_117' from 'INSTALL_SUBS' isn't a code reference/, 'is not a code reference' ;
}