blob: b036af7e0b367a37c51fc2c1e08f39dc317ef65d (
plain)
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
|
use strict;
use Test::More;
use xt::CLI;
subtest 'snapshot file has canonical representation' => sub {
my $app = cli();
$app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.11';
requires 'Getopt::Long', '2.41';
EOF
$app->run("install");
my $content = $app->dir->child('cpanfile.snapshot')->slurp;
for (1..3) {
$app->dir->child('cpanfile.snapshot')->remove;
$app->run("install");
is $content, $app->dir->child('cpanfile.snapshot')->slurp;
}
};
subtest 'Bad snapshot version' => sub {
my $app = cli();
$app->write_cpanfile('');
$app->write_file('cpanfile.snapshot', <<EOF);
# carton snapshot format: version 111
EOF
$app->run("install");
like $app->stderr, qr/Could not parse/;
};
subtest 'Bad snapshot file' => sub {
my $app = cli();
$app->write_cpanfile('');
$app->write_file('cpanfile.snapshot', <<EOF);
# carton snapshot format: version 1.0
DISTRIBUTIONS
Foo-Bar-1
unknown: foo
EOF
$app->run("install");
like $app->stderr, qr/Could not parse/;
};
subtest 'snapshot file support separate CRLF' => sub {
my $app = cli();
$app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.11';
requires 'Getopt::Long', '2.41';
EOF
$app->run("install");
my $content = $app->dir->child('cpanfile.snapshot')->slurp;
$content =~ s/\n/\r\n/g;
$app->write_file('cpanfile.snapshot', $content);
$app->run("install");
ok !$app->stderr;
};
done_testing;
|