Sha256: 7166957b2c4091f562594412b1dcdfdd073cfaba35e6cc59a75897565c8ae5f9

Contents?: true

Size: 1.11 KB

Versions: 29

Compression:

Stored size: 1.11 KB

Contents

require 'test/unit'
require 'net/ftp/list'

class TestNetFTPListMicrosoft < Test::Unit::TestCase

  def setup
    #                             DATE      TIME          DIR      SIZE  NAME
    @dir  = Net::FTP::List.parse('06-25-07  01:08PM       <DIR>          etc')
    @file = Net::FTP::List.parse('11-27-07  08:45PM                23437 README.TXT')
  end

  def test_parse_new
    assert_instance_of Net::FTP::List::Microsoft, @dir, 'LIST M$ directory'
    assert_instance_of Net::FTP::List::Microsoft, @file, 'LIST M$ file'
  end

  def test_rubbish_lines
    assert_instance_of Net::FTP::List::Unknown, Net::FTP::List.parse("++ bah! ++")
  end
  
  def test_ruby_micrsoft_mtime
    assert_equal DateTime.strptime('06-25-07  01:08PM', "%m-%d-%y  %I:%M%p"), @dir.mtime
    assert_equal DateTime.strptime('11-27-07  08:45PM', "%m-%d-%y  %I:%M%p"), @file.mtime
  end

  def test_ruby_microsoft_like_dir
    assert_equal 'etc', @dir.basename
    assert @dir.dir?
    assert !@dir.file?
  end

  def test_ruby_microsoft_like_file
    assert_equal 'README.TXT', @file.basename
    assert @file.file?
    assert !@file.dir?
  end

end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
redcar-dev-0.12.1dev-java plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-dev-0.12.0dev-java plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.11 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.11.0dev plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.10 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.9.2 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.9.1 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.9.0 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.8.1 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.8 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.7 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.6.1 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.6 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.6.1dev plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.5.1 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.5 plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.5.6dev plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.5.5dev plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.5.4dev plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb
redcar-0.5.3dev plugins/project/vendor/net-ftp-list/test/test_net_ftp_list_microsoft.rb