mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
68ebbbfebe
* lib/pp.rb: Ditto. * lib/prettyprint.rb: Ditto. * lib/resolv.rb: Ditto. * lib/securerandom.rb: Ditto. * lib/tmpdir.rb: Ditto. * lib/unicode_normalize/tables.rb: Ditto. * test/net/ftp/test_buffered_socket.rb: Ditto. * test/net/ftp/test_mlsx_entry.rb: Ditto. * test/open-uri/test_open-uri.rb: Ditto. * test/open-uri/test_ssl.rb: Ditto. * test/pathname/test_pathname.rb: Ditto. * test/test_pp.rb: Ditto. * test/test_prettyprint.rb: Ditto. * tool/transcode-tblgen.rb: Ditto. * ext/pathname/lib/pathname.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
98 lines
3.2 KiB
Ruby
98 lines
3.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "net/ftp"
|
|
require "test/unit"
|
|
require "ostruct"
|
|
require "stringio"
|
|
|
|
class MLSxEntryTest < Test::Unit::TestCase
|
|
def test_file?
|
|
assert_equal(true, Net::FTP::MLSxEntry.new({"type"=>"file"}, "foo").file?)
|
|
assert_equal(false, Net::FTP::MLSxEntry.new({"type"=>"dir"}, "foo").file?)
|
|
assert_equal(false, Net::FTP::MLSxEntry.new({"type"=>"cdir"}, "foo").file?)
|
|
assert_equal(false, Net::FTP::MLSxEntry.new({"type"=>"pdir"}, "foo").file?)
|
|
end
|
|
|
|
def test_directory?
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"type"=>"file"}, "foo").directory?)
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"type"=>"dir"}, "foo").directory?)
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"type"=>"cdir"}, "foo").directory?)
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"type"=>"pdir"}, "foo").directory?)
|
|
end
|
|
|
|
def test_appendable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"a"}, "foo").appendable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").appendable?)
|
|
end
|
|
|
|
def test_creatable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"c"}, "foo").creatable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").creatable?)
|
|
end
|
|
|
|
def test_deletable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"d"}, "foo").deletable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").deletable?)
|
|
end
|
|
|
|
def test_enterable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"e"}, "foo").enterable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").enterable?)
|
|
end
|
|
|
|
def test_renamable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"f"}, "foo").renamable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").renamable?)
|
|
end
|
|
|
|
def test_listable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"l"}, "foo").listable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").listable?)
|
|
end
|
|
|
|
def test_directory_makable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"m"}, "foo").
|
|
directory_makable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").
|
|
directory_makable?)
|
|
end
|
|
|
|
def test_purgeable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"p"}, "foo").purgeable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").purgeable?)
|
|
end
|
|
|
|
def test_readable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"r"}, "foo").readable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").readable?)
|
|
end
|
|
|
|
def test_writable?
|
|
assert_equal(true,
|
|
Net::FTP::MLSxEntry.new({"perm"=>"w"}, "foo").writable?)
|
|
assert_equal(false,
|
|
Net::FTP::MLSxEntry.new({"perm"=>""}, "foo").writable?)
|
|
end
|
|
end
|