Module: Treebis::Test::TestAntecedents
- Included in:
- TestCase
- Defined in:
- lib/treebis.rb
Instance Method Summary collapse
Instance Method Details
#setup_antecedents ⇒ Object
991 992 993 994 995 996 997 998 999 1000 |
# File 'lib/treebis.rb', line 991 def setup_antecedents src = empty_tmpdir('sourceis') task.new do mkdir_p "foo/bar/baz" write "foo/bar/baz/alpha.txt", 'x' write "foo/bar/beta.txt", 'x' write "foo/gamma.txt", 'x' end.on(src).run src end |
#test_antecedents ⇒ Object
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 |
# File 'lib/treebis.rb', line 1001 def test_antecedents src = setup_antecedents tt = task.new do from src mkdir_p "foo/bar/baz" copy "foo/bar/baz/alpha.txt" copy "foo/bar/beta.txt" copy "foo/gamma.txt" end tgt = empty_tmpdir('targetis') bb, cc, aa = capture3{ tt.on(tgt).run } assert_equal [nil, ''], [aa,bb] penu, last = cc.split("\n")[-2..-1] assert penu.index("...bar/beta.txt foo/bar/beta.txt") assert last.index("...eis/foo/gamma.txt foo/gamma.txt") end |
#test_antecedents_raw ⇒ Object
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 |
# File 'lib/treebis.rb', line 1018 def test_antecedents_raw fu = file_utils src = setup_antecedents tgt = empty_tmpdir('targetis') these = %w( foo/bar/baz/alpha.txt foo/bar/beta.txt foo/gamma.txt ) fu.pretty! out, err = capture3 do fu.mkdir_p File.join(tgt,'foo/bar/baz') these.each do |foo| from, to = File.join(src,foo), File.join(tgt,foo) fu.cp from, to end end assert_equal '', out penu, last = err.split("\n")[-2..-1] assert penu.index(' ...bar/beta.txt ...bar/beta.txt') assert last.index('...eis/foo/gamma.txt ...tis/foo/gamma.txt') end |