Skip to content

Commit

Permalink
[6.d] Deprecate IO::Handle.slurp-rest
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Sep 28, 2017
1 parent 6d2adb2 commit 3341384
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/core/IO/Handle.pm
Expand Up @@ -674,9 +674,8 @@ my class IO::Handle {

proto method slurp-rest(|) { * }
multi method slurp-rest(IO::Handle:D: :$bin! where *.so, :$close --> Buf:D) {
# NOTE: THIS METHOD WILL BE DEPRECATED IN 6.d in favour of .slurp()
# Testing of it in roast master has been removed and only kept in 6.c
# If you're changing this code for whatever reason, test with 6.c-errata
DEPRECATED '.slurp', '6.d', '6.e', :lang-vers;

LEAVE self.close if $close;
my $res := buf8.new;
loop {
Expand All @@ -687,9 +686,8 @@ my class IO::Handle {
}
}
multi method slurp-rest(IO::Handle:D: :$enc, :$bin, :$close --> Str:D) {
# NOTE: THIS METHOD WILL BE DEPRECATED IN 6.d in favour of .slurp()
# Testing of it in roast master has been removed and only kept in 6.c
# If you're changing this code for whatever reason, test with 6.c-errata
DEPRECATED '.slurp', '6.d', '6.e', :lang-vers;

$!decoder or die X::IO::BinaryMode.new(:trying<slurp-rest>);
LEAVE self.close if $close;
self.encoding($enc) if $enc.defined;
Expand Down
9 changes: 8 additions & 1 deletion t/02-rakudo/v6.d-tests/01-deprecations.t
Expand Up @@ -2,7 +2,7 @@ use lib <t/spec/packages/>;
use Test;
use Test::Util;

plan 10;
plan 11;

# XXX TODO: swap v6.d.PREVIEW to v6.d, once the latter is available
constant $v6d = 'v6.d.PREVIEW';
Expand Down Expand Up @@ -35,3 +35,10 @@ is-newly-deprecated 「$ = 4.2.FatRat: 42」;
is-newly-deprecated $ = FatRat.new(4,2).Rat: 42;
is-newly-deprecated $ = FatRat.new(4,2).FatRat: 42;
is-newly-deprecated ".".IO.chdir: ".";

subtest 'IO::Handle.slurp-rest' => {
plan 4;
my $file := make-temp-file(:content<foo>).absolute.perl;
is-newly-deprecated "$file.IO.open.slurp-rest";
is-newly-deprecated "$file.IO.open.slurp-rest: :bin";
}

0 comments on commit 3341384

Please sign in to comment.