Skip to content

Commit

Permalink
pathname cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
quix committed Aug 23, 2009
1 parent 21dd68b commit fb99b44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/quix/ext/pathname.rb
Expand Up @@ -58,9 +58,9 @@ def replace(open_flags_read = ["r"], open_flags_write = ["w"])
} }
end end


BINARY_ENCODING = RUBY_VERSION < "1.9" ? "" : ":ASCII-8BIT" binary_encoding = RUBY_VERSION < "1.9" ? "" : ":ASCII-8BIT"
BINARY_READ_FLAGS = "rb" + BINARY_ENCODING BINARY_READ_FLAGS = "rb" + binary_encoding
BINARY_WRITE_FLAGS = "wb" + BINARY_ENCODING BINARY_WRITE_FLAGS = "wb" + binary_encoding


unless method_defined?(:binread) unless method_defined?(:binread)
def binread(length = nil, offset = nil) def binread(length = nil, offset = nil)
Expand Down
9 changes: 5 additions & 4 deletions test/test_pathname.rb
Expand Up @@ -145,7 +145,7 @@ def test_glob_files


if File::ALT_SEPARATOR == "\\" if File::ALT_SEPARATOR == "\\"
def test_initialize def test_initialize
assert_equal "a/b/c", Pathname("a\\b\\c").to_s assert_equal Pathname("a/b/c"), Pathname("a\\b\\c")
end end
end end


Expand All @@ -154,8 +154,9 @@ def test_copy_to
contents = "abab" contents = "abab"
source.write(contents) source.write(contents)
assert(!dest.exist?) assert(!dest.exist?)
source.copy_to(dest) result = source.copy_to(dest)
assert contents, source.read assert_equal contents, source.read
assert contents, dest.read assert_equal contents, dest.read
assert_equal dest, result
end end
end end

0 comments on commit fb99b44

Please sign in to comment.