root/trunk/plagger/t/core/log-level.t

Revision 1656 (checked in by miyagawa, 14 years ago)
  • Updated captured variable name to $warnings.
  • Fixed POD bug in Publish::Takahashi
  • Updated ID of Publish::Takahashi test to use MD5 of file path, since it depends on local path, Eh.
  • Added failing test for Planet XSS bug
Line 
1 use strict;
2 use t::TestPlagger;
3
4 plan 'no_plan';
5 run_eval_expected_with_capture;
6
7 package Plagger::Plugin::Test::Log;
8 use base qw( Plagger::Plugin );
9
10 sub register {
11     my($self, $context) = @_;
12     $self->log(error => "this is error");
13     $self->log(info  => "this is info");
14     $self->log(warn  => "this is warn");
15     $self->log(debug => "this is debug");
16 }
17
18 package main;
19
20 __END__
21
22 === log level is debug
23 --- input config
24 global:
25   log:
26     level: debug
27 plugins:
28   - module: Test::Log
29 --- expected
30 like $warnings, qr/error/;
31 like $warnings, qr/info/;
32 like $warnings, qr/warn/;
33 like $warnings, qr/debug/;
34
35 === info log level
36 --- input config
37 global:
38   log:
39     level: info
40 plugins:
41   - module: Test::Log
42 --- expected
43 like $warnings, qr/error/;
44 like $warnings, qr/info/;
45 unlike $warnings, qr/warn/;
46 unlike $warnings, qr/debug/;
Note: See TracBrowser for help on using the browser.