Sha256: bd3ebd2f170b5929b69bd06904e4e2115348c3790efd731d84af1ac7146de5ae
Contents?: true
Size: 1.17 KB
Versions: 4
Compression:
Stored size: 1.17 KB
Contents
require 'test/unit' require 'facet/fileutils/wc' class TC_FileUtils_WC < Test::Unit::TestCase def setup @workdir = Dir.getwd @thisdir = File.dirname(__FILE__) @file = 'test_file.txt' end def test_method assert_respond_to( FileUtils, :wc ) end def test_wc Dir.chdir @thisdir begin assert_nothing_raised{ FileUtils.wc(@file) } assert_nothing_raised{ FileUtils.wc(@file,'bytes') } assert_nothing_raised{ FileUtils.wc(@file,'chars') } assert_nothing_raised{ FileUtils.wc(@file,'words') } assert_nothing_raised{ FileUtils.wc(@file,'lines') } assert_raises(RuntimeError){ FileUtils.wc(@file,'bogus') } ensure Dir.chdir @workdir end end def test_wc_results Dir.chdir @thisdir begin assert_equal([166,166,25,25],FileUtils.wc(@file)) assert_equal(166,FileUtils.wc(@file,'bytes'),"Wrong number of bytes") assert_equal(166,FileUtils.wc(@file,'chars'),"Wrong number of chars") assert_equal(25,FileUtils.wc(@file,'words'),"Wrong number of words") assert_equal(25,FileUtils.wc(@file,'lines'),"Wrong number of lines") ensure Dir.chdir @workdir end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
facets-0.6.3 | test/fileutils/tc_wc.rb |
facets-0.7.0 | test/fileutils/tc_wc.rb |
facets-0.7.1 | test/fileutils/tc_wc.rb |
facets-0.7.2 | test/fileutils/tc_wc.rb |