1require File.expand_path('../helper', __FILE__) 2 3class TestRakePathMapPartial < Rake::TestCase 4 def test_pathmap_partial 5 @path = "1/2/file" 6 def @path.call(n) 7 pathmap_partial(n) 8 end 9 assert_equal("1", @path.call(1)) 10 assert_equal("1/2", @path.call(2)) 11 assert_equal("1/2", @path.call(3)) 12 assert_equal(".", @path.call(0)) 13 assert_equal("2", @path.call(-1)) 14 assert_equal("1/2", @path.call(-2)) 15 assert_equal("1/2", @path.call(-3)) 16 end 17end 18 19