-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* lib/net/ftp.rb (file?, directory?, appendable?, creatable?,
deletable?, enterable?, renamable?, listable?, directory_makable?, purgeable?, readable?, writable?): new methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
- v3_4_1
- v3_4_0
- v3_4_0_rc1
- v3_4_0_preview2
- v3_4_0_preview1
- v3_3_6
- v3_3_5
- v3_3_4
- v3_3_3
- v3_3_2
- v3_3_1
- v3_3_0
- v3_3_0_rc1
- v3_3_0_preview3
- v3_3_0_preview2
- v3_3_0_preview1
- v3_2_6
- v3_2_5
- v3_2_4
- v3_2_3
- v3_2_2
- v3_2_1
- v3_2_0
- v3_2_0_rc1
- v3_2_0_preview3
- v3_2_0_preview2
- v3_2_0_preview1
- v3_1_6
- v3_1_5
- v3_1_4
- v3_1_3
- v3_1_2
- v3_1_1
- v3_1_0
- v3_1_0_preview1
- v3_0_7
- v3_0_6
- v3_0_5
- v3_0_4
- v3_0_3
- v3_0_2
- v3_0_1
- v3_0_0
- v3_0_0_rc2
- v3_0_0_rc1
- v3_0_0_preview2
- v3_0_0_preview1
- v2_7_8
- v2_7_7
- v2_7_6
- v2_7_5
- v2_7_4
- v2_7_3
- v2_7_2
- v2_7_1
- v2_7_0
- v2_7_0_rc2
- v2_7_0_rc1
- v2_7_0_preview3
- v2_7_0_preview2
- v2_7_0_preview1
- v2_6_10
- v2_6_9
- v2_6_8
- v2_6_7
- v2_6_6
- v2_6_5
- v2_6_4
- v2_6_3
- v2_6_2
- v2_6_1
- v2_6_0
- v2_6_0_rc2
- v2_6_0_rc1
- v2_6_0_preview3
- v2_6_0_preview2
- v2_6_0_preview1
- v2_5_9
- v2_5_8
- v2_5_7
- v2_5_6
- v2_5_5
- v2_5_4
- v2_5_3
- v2_5_2
- v2_5_1
- v2_5_0
- v2_5_0_rc1
- v2_5_0_preview1
- v2_4_10
- v2_4_9
- v2_4_8
- v2_4_7
- v2_4_6
- v2_4_5
- v2_4_4
- v2_4_3
- v2_4_2
- v2_4_1
- v2_4_0
- v2_4_0_rc1
- v2_4_0_preview3
- v2_4_0_preview2
- v2_4_0_preview1
- v2_3_8
- v2_3_7
- v2_3_6
- v2_3_5
- v2_3_4
- v2_3_3
- v2_3_2
- v2_3_1
- v2_3_0
- v2_3_0_preview2
- v2_3_0_preview1
Showing
4 changed files
with
210 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
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 |