File: 10-simple.t

package info (click to toggle)
libfilter-eof-perl 0.04-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: perl: 1,083; makefile: 7
file content (66 lines) | stat: -rw-r--r-- 1,276 bytes parent folder | download | duplicates (3)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!perl
use warnings;
use strict;

use Test::More tests => 12;

use FindBin;
use lib "$FindBin::Bin/lib";

use_ok('SimpleTest');

no warnings 'once';

#
#   IMPORT HANDLER
#

ok( $SimpleTest::TEST_ON_IMPORT,
    'import handler was called');
is( $SimpleTest::TEST_ON_IMPORT_CLASS, 'SimpleFilter',
    'import handler received correct class');
is_deeply($SimpleTest::TEST_ON_IMPORT_ARGS, [qw(foo 23 bar 13)],
    'import handler received correct arguments');

#
#   EOF HANDLER
#

ok( $SimpleTest::TEST_ON_EOF, 
    'eof handler was called');
is( $SimpleTest::TEST_ON_IMPORT_CLASS, 'SimpleFilter',
    'eof handler received correct class');

#
#   ORDER OF HANDLERS
#

is_deeply($SimpleTest::TEST_ORDER, [qw(on_import on_eof)],
    'handlers were called in correct order');

#
#   HANDLER CALLED IN CORRECT PHASE
#

ok( $SimpleTest::TEST_COMPILETIME,
    'import handler called before compilation');
ok( $SimpleTest::TEST_RUNTIME,
    'eof handler called before execution');

#
#   EXPORTING WORKED CORRECTLY
#

ok( SimpleTest->can('test_export'),
    'function was exported from filter');
is( SimpleTest->test_export, 23,
    'correct function was exported');

#
#   MODIFICATION WORKS
#

ok( $SimpleTest::TEST_MODIFICATION,
    'source code modification through @_ works');