diff --git a/src/core/IO/Handle.pm b/src/core/IO/Handle.pm index debb60e8351..40bffae7958 100644 --- a/src/core/IO/Handle.pm +++ b/src/core/IO/Handle.pm @@ -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 { @@ -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); LEAVE self.close if $close; self.encoding($enc) if $enc.defined; diff --git a/t/02-rakudo/v6.d-tests/01-deprecations.t b/t/02-rakudo/v6.d-tests/01-deprecations.t index 01fa3d1974c..b6075394b09 100644 --- a/t/02-rakudo/v6.d-tests/01-deprecations.t +++ b/t/02-rakudo/v6.d-tests/01-deprecations.t @@ -2,7 +2,7 @@ use lib ; 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'; @@ -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).absolute.perl; + is-newly-deprecated "$file.IO.open.slurp-rest"; + is-newly-deprecated "$file.IO.open.slurp-rest: :bin"; +}