Skip to content

Commit 87c3157

Browse files
committed
Correct doc and error message for File.cp!/3
1 parent 23c55b4 commit 87c3157

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/elixir/lib/file.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,14 +480,14 @@ defmodule File do
480480

481481
@doc """
482482
The same as `cp/3`, but raises `File.CopyError` if it fails.
483-
Returns the list of copied files otherwise.
483+
Returns `:ok` otherwise.
484484
"""
485485
@spec cp!(Path.t, Path.t, (Path.t, Path.t -> boolean)) :: :ok | no_return
486486
def cp!(source, destination, callback \\ fn(_, _) -> true end) do
487487
case cp(source, destination, callback) do
488488
:ok -> :ok
489489
{:error, reason} ->
490-
raise File.CopyError, reason: reason, action: "copy recursively",
490+
raise File.CopyError, reason: reason, action: "copy",
491491
source: IO.chardata_to_string(source), destination: IO.chardata_to_string(destination)
492492
end
493493
end

lib/elixir/test/elixir/file_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ defmodule FileTest do
123123
test :cp_with_src_dir! do
124124
src = fixture_path("cp_r")
125125
dest = tmp_path("tmp.file")
126-
assert_raise File.CopyError, "could not copy recursively from #{src} to #{dest}: " <>
126+
assert_raise File.CopyError, "could not copy from #{src} to #{dest}: " <>
127127
"illegal operation on a directory", fn ->
128128
File.cp!(src, dest)
129129
end
@@ -883,7 +883,7 @@ defmodule FileTest do
883883
end
884884
end
885885

886-
test :lstat do
886+
test :lstat do
887887
{:ok, info} = File.lstat(__ENV__.file)
888888
assert info.mtime
889889
end

0 commit comments

Comments
 (0)