File: all-exports.t

package info (click to toggle)
libfile-libmagic-perl 1.02-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 524 kB
  • ctags: 849
  • sloc: perl: 1,616; pascal: 88; ansic: 54; makefile: 13
file content (34 lines) | stat: -rw-r--r-- 711 bytes parent folder | download
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
use strict;
use warnings;

use lib 't/lib';

use Test::AnyOf;
use Test::More 0.88;

use File::LibMagic qw( :all );

# subs from :easy
is( MagicBuffer("Hello World\n"), 'ASCII text' );

is( MagicFile('t/samples/foo.txt'), 'ASCII text' );
is_any_of(
    MagicFile('t/samples/foo.c'),
    [ 'ASCII C program text', 'C source, ASCII text' ]
);

# subs from :complete
my $handle = magic_open(MAGIC_NONE);
magic_load( $handle, q{} );
is( magic_buffer( $handle, "Hello World\n" ), 'ASCII text' );

is( magic_file( $handle, 't/samples/foo.txt' ), 'ASCII text' );

is_any_of(
    magic_file( $handle, 't/samples/foo.c' ),
    [ 'ASCII C program text', 'C source, ASCII text' ]
);

magic_close($handle);

done_testing();