Sha256: 50b616b4a313622e5b5fc3349a3e74a0b1739347d92dd24423c44002fa11d05c
Contents?: true
Size: 1.33 KB
Versions: 11
Compression:
Stored size: 1.33 KB
Contents
require 'test/unit' # Select training if you want to renew golden files. # TRAINING = true TRAINING = false Test::Unit.at_start do # Suite initialization. Dir.chdir( 'test' ) $diru = "#{Dir.pwd}/../bin/diru" system( "#{$diru} --hport 43114 --hub" ) system( "#{$diru} --hport 43114 -s" ) end Test::Unit.at_exit do # Suite teardown. FileUtils.rm_f( "test_bookmarks.txt" ) FileUtils.rm_f( "test_basic.log" ) unless TRAINING system( "#{$diru} --hport 43114 --hkill" ) Dir.chdir( '..' ) end # Tests. class DiruTest < Test::Unit::TestCase def setup end def teardown assert( system( "diff test_basic.log golden.log" ), "FAILED: golden file diff" ) unless TRAINING end def test_basic() system( "sh -c test_diru.sh 2>&1 | tee test_basic.log > /dev/null" ) end end if false # Paste to IRB for test directory creation. # <clip> require 'fileutils' def create_dirs( level, base ) if level.empty? FileUtils.touch "empty.txt" return end cnt = level[0] cnt.times do |i| sub = "#{base}_#{i}" FileUtils.mkdir sub Dir.chdir sub create_dirs( level[1..-1], sub ) Dir.chdir ".." end end create_dirs [2,5,3], "dir" # </clip> end
Version data entries
11 entries across 11 versions & 1 rubygems