Skip to content

Commit

Permalink
Ensure deleting files
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Dec 19, 2023
1 parent a8cb9e7 commit b01da8d
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions test/stdlib/File_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,26 @@ def test_lchown
end

def test_link
assert_send_type "(String, String) -> 0",
File, :link, File.expand_path(__FILE__), "new_name"
File.unlink("new_name")
begin
assert_send_type "(String, String) -> 0",
File, :link, File.expand_path(__FILE__), "new_name"
ensure
File.unlink("new_name")
end

assert_send_type "(ToStr, ToStr) -> 0",
File, :link, ToStr.new(File.expand_path(__FILE__)), ToStr.new("new_name")
File.unlink("new_name")
begin
assert_send_type "(ToStr, ToStr) -> 0",
File, :link, ToStr.new(File.expand_path(__FILE__)), ToStr.new("new_name")
ensure
File.unlink("new_name")
end

assert_send_type "(ToPath, ToPath) -> 0",
File, :link, ToPath.new(File.expand_path(__FILE__)), ToPath.new("new_name")
File.unlink("new_name")
begin
assert_send_type "(ToPath, ToPath) -> 0",
File, :link, ToPath.new(File.expand_path(__FILE__)), ToPath.new("new_name")
ensure
File.unlink("new_name")
end
end

def test_lstat
Expand Down

0 comments on commit b01da8d

Please sign in to comment.