diff options
-rw-r--r-- | lib/Carton/Snapshot/Parser.pm | 2 | ||||
-rw-r--r-- | xt/cli/snapshot.t | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/Carton/Snapshot/Parser.pm b/lib/Carton/Snapshot/Parser.pm index 23c3d52..b3a0b7a 100644 --- a/lib/Carton/Snapshot/Parser.pm +++ b/lib/Carton/Snapshot/Parser.pm @@ -90,7 +90,7 @@ my $machine = { sub parse { my($self, $data, $snapshot) = @_; - my @lines = split /\n/, $data; + my @lines = split /\r?\n/, $data; my $state = $machine->{init}; my $stash = {}; diff --git a/xt/cli/snapshot.t b/xt/cli/snapshot.t index 2b0254d..b036af7 100644 --- a/xt/cli/snapshot.t +++ b/xt/cli/snapshot.t @@ -44,5 +44,22 @@ EOF 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; |