Sha256: 6fdd6216b5271bef04c3b44180ae82d55ea05339a2434f26cc859ae482963674
Contents?: true
Size: 858 Bytes
Versions: 13
Compression:
Stored size: 858 Bytes
Contents
require 'facets/dir/recurse' require 'test/unit' require 'fileutils' require 'tmpdir' class TC_Dir_Recurse < Test::Unit::TestCase DIRS = %w{A A/B} FILES = %w{A.txt A/B.txt A/B/C.txt} def setup @location = File.join(Dir.tmpdir, self.class.name, Time.now.usec.to_s) DIRS.each do |x| FileUtils.mkdir_p(File.join(@location, x)) end FILES.each do |x| File.open(File.join(@location, x), 'w'){ |f| f << "SPINICH" } end end def teardown FileUtils.rm_r(@location) end def test_recurse Dir.chdir @location do rs = (DIRS + FILES).sort fs = Dir.recurse.sort assert_equal( rs, fs, Dir.pwd ) end end def test_ls_r Dir.chdir @location do rs = (DIRS + FILES).sort fs = Dir.ls_r.sort assert_equal( rs, fs, Dir.pwd ) end end end
Version data entries
13 entries across 13 versions & 1 rubygems