Sha256: c9dc8802cce98633a3db5b48d31f95a7f9d8c05a143f40354eef1813d031bbd1
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
# Test for facets/file/sanitize.rb. require 'facets/file/sanitize.rb' require 'test/unit' class TC_File_Sanitize < Test::Unit::TestCase # mock file class MockFile < File def self.open( fname, mode, &blk ) blk.call(self) end def self.read( fname=nil ) @mock_content.clone end def self.write( str ) @mock_content = str end def self.<<( str ) (@mock_content ||="") << str end end # TODO Write file identity tests. def test_sanitize_01 assert_equal( "This_is_a_test", MockFile.sanitize('This is a test') ) end def test_sanitize_02 assert_equal( "test", MockFile.sanitize('This\is\test') ) end def test_sanitize_03 assert_equal( "test", MockFile.sanitize('This/is/test') ) end def test_sanitize_04 assert_equal( "te_____st", MockFile.sanitize('This/te#$#@!st') ) end def test_sanitize_05 assert_equal( "_.", MockFile.sanitize('.') ) end def test_sanitize_06 assert_equal( "_....", MockFile.sanitize('....') ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facets-2.2.1 | test/unit/file/test_sanitize.rb |
facets-2.3.0 | test/core/file/test_sanitize.rb |