-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path20add-libmagic.t
50 lines (45 loc) · 1.53 KB
/
20add-libmagic.t
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
#!/usr/bin/perl -w
use Test::More tests => 2;
use strict;
use SVK::Test;
our $output;
my ($xd, $svk) = build_test();
my ($copath, $corpath) = get_copath();
my ($repospath, undef, $repos) = $xd->find_repos ('//', 1);
$svk->checkout ('//', $copath);
chdir ($copath);
# Create some files with different mime types
create_mime_samples('mime');
# try the LibMagic MIME detection engine
SKIP: {
eval { require File::LibMagic };
skip 'File::LibMagic is not installed', 2 if $@;
my $libmagic_version = File::LibMagic->VERSION();
skip "File::LibMagic 0.84 required ($libmagic_version installed)", 2
if $libmagic_version < 0.84;
diag "File::LibMagic version $libmagic_version";
local $ENV{SVKMIME} = 'File::LibMagic';
is_output ($svk, 'add', ['mime'],
[__('A mime'),
__('A mime/empty.txt'),
__('A mime/false.bin'),
__('A mime/foo.bin - (bin)'),
__('A mime/foo.c'),
__('A mime/foo.html'),
__('A mime/foo.jpg - (bin)'),
__('A mime/foo.pl'),
__('A mime/foo.txt'),
__('A mime/not-audio.txt'),
]);
is_output ($svk, 'pl', ['-v', glob("mime/*")],
[__('Properties on mime/foo.bin:'),
' svn:mime-type: application/octet-stream',
__('Properties on mime/foo.c:'),
' svn:mime-type: text/x-c',
__('Properties on mime/foo.html:'),
' svn:mime-type: text/html',
__('Properties on mime/foo.jpg:'),
' svn:mime-type: image/jpeg',
]);
$svk->revert ('-R', 'mime');
}