diff options
author | Tatsuhiko Miyagawa <miyagawa@bulknews.net> | 2013-08-30 00:52:14 -0700 |
---|---|---|
committer | Tatsuhiko Miyagawa <miyagawa@bulknews.net> | 2013-08-30 00:52:14 -0700 |
commit | 2131a6a0d20542575e841a214c84075376c3ce68 (patch) | |
tree | babfbb7b010bfc90d6038254b817941aeeca5760 | |
parent | c3f9e7a6507a479af34650f4a033df598a054898 (diff) | |
parent | 7453ffac83e4ad5f85f7aaca129925d515c31667 (diff) | |
download | carton-2131a6a0d20542575e841a214c84075376c3ce68.tar.gz |
Merge pull request #133 from kan/master
support CRLF in cpanfile.snapshot
-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; |