Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/pathname/pathname.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ path_split(VALUE self)
VALUE str = get_strpath(self);
VALUE ary, dirname, basename;
ary = rb_funcall(rb_cFile, id_split, 1, str);
ary = rb_check_array_type(ary);
Check_Type(ary, T_ARRAY);
dirname = rb_ary_entry(ary, 0);
basename = rb_ary_entry(ary, 1);
dirname = rb_class_new_instance(1, &dirname, rb_obj_class(self));
Expand Down
15 changes: 15 additions & 0 deletions test/pathname/test_pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,21 @@ def test_expand_path

def test_split
assert_equal([Pathname("dirname"), Pathname("basename")], Pathname("dirname/basename").split)

assert_separately([], <<-'end;')
require 'pathname'

mod = Module.new do
def split(_arg)
end
end

File.singleton_class.prepend(mod)

assert_raise(TypeError) do
Pathname('/').split
end
end;
end

def test_blockdev?
Expand Down