Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 54 lines (40 sloc) 1.45 kB
0310b6c @daotoad Complete deworkification of files.
authored
1 #!/usr/bin/perl
5310b14 @daotoad Initial stuff or stuff.
authored
2 use strict;
3 use warnings;
4
3d87fc5 @daotoad Modified Log::Lager subs to work with :: or ->
authored
5 use Test::More tests => 12;
5310b14 @daotoad Initial stuff or stuff.
authored
6
a0e5176 @daotoad CPANification underway.
authored
7 use Log::Lager::CommandParser 'parse_command';
4b7970f @daotoad Added round trip test for apply_command/log_level. Fixed error in st…
authored
8 use Log::Lager;
5310b14 @daotoad Initial stuff or stuff.
authored
9
a0e5176 @daotoad CPANification underway.
authored
10 my $cp = Log::Lager::CommandParser->new;
11 isa_ok( $cp, 'Log::Lager::CommandParser' );
5310b14 @daotoad Initial stuff or stuff.
authored
12 is( $cp->{state}, 'start', 'state initialized correctly' );
13 is( my $state = $cp->state(), 'start', 'state initialized correctly' );
14 is( $cp->mask_select, 'lexical', 'mask_select initialized correctly' );
15 is( $cp->mask_group, 'enable', 'mask_group initialized correctly' );
16
a0e5176 @daotoad CPANification underway.
authored
17 isa_ok( $cp->result, 'Log::Lager::CommandResult' );
5310b14 @daotoad Initial stuff or stuff.
authored
18
4b7970f @daotoad Added round trip test for apply_command/log_level. Fixed error in st…
authored
19 my @COMMAND = (
5310b14 @daotoad Initial stuff or stuff.
authored
20 'base enable FEW stack DWIT F nostack E',
21 'lexical compact F pretty W disable G lexoff',
22 'sub Foo::Bar::quix',
23 'package Foo::Bar::Baz enable FEWI fatal F',
24 'stderr',
889d9f8 @daotoad Added new term "fileterm" to command language, sets file permissions.
authored
25 'file /potato/soup/is/vicious fileperm 644',
4b7970f @daotoad Added round trip test for apply_command/log_level. Fixed error in st…
authored
26 );
27
28 my $r;
29 ok( eval {
30 $r = parse_command( @COMMAND );
31 1;
5310b14 @daotoad Initial stuff or stuff.
authored
32 }, 'Parse command w/o error '. $@ );
33
a0e5176 @daotoad CPANification underway.
authored
34 isa_ok( $r, 'Log::Lager::CommandResult');
5310b14 @daotoad Initial stuff or stuff.
authored
35
36 is( ''. parse_command("$r"), "$r", 'Round trip OK' );
37
4b7970f @daotoad Added round trip test for apply_command/log_level. Fixed error in st…
authored
38 ok( eval {
39 Log::Lager::apply_command( @COMMAND );
40 1;
41 }, "Apply command without error $@" );
42
43 my $log_level = Log::Lager::log_level;
44 Log::Lager::apply_command($log_level);
45 my $round_trip = Log::Lager::log_level;
46 is( $log_level, $round_trip, 'Round trip OK' );
3d87fc5 @daotoad Modified Log::Lager subs to work with :: or ->
authored
47
48 Log::Lager::apply_command('stderr');
49 Log::Lager->apply_command( $log_level );
50 my $arrows = Log::Lager->log_level;
51 is( $arrows, $round_trip, 'Round trip OK' );
52
53
Something went wrong with that request. Please try again.