~ubuntu-branches/ubuntu/precise/rake/precise

« back to all changes in this revision

Viewing changes to test/test_pathmap.rb

  • Committer: Bazaar Package Importer
  • Author(s): Adam Majer
  • Date: 2008-01-28 11:42:11 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20080128114211-8l1wcx1k9s6oa8s6
Tags: 0.8.1-3
Apply upstream patch (SVN r632) correcting one of the unit
tests. The old unit test depends on the file system ordering
while the new ones just check for consistency. File order is
unimportant. (closes: #462817)

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    assert_equal "abc", "abc".pathmap("%X")
61
61
    assert_equal "abc", "abc.rb".pathmap("%X")
62
62
    assert_equal "abc.xyz", "abc.xyz.rb".pathmap("%X")
 
63
    assert_equal "ab.xyz", "ab.xyz.rb".pathmap("%X")
 
64
    assert_equal "a.xyz", "a.xyz.rb".pathmap("%X")
 
65
    assert_equal "abc", "abc.rb".pathmap("%X")
 
66
    assert_equal "ab", "ab.rb".pathmap("%X")
 
67
    assert_equal "a", "a.rb".pathmap("%X")
63
68
    assert_equal ".depends", ".depends".pathmap("%X")
64
69
    assert_equal "a/dir/.depends", "a/dir/.depends".pathmap("%X")
65
70
    assert_equal "/.depends", "/.depends".pathmap("%X")
181
186
  end
182
187
end
183
188
 
 
189
class TestPathMapPartial < Test::Unit::TestCase
 
190
  def test_pathmap_partial
 
191
    @path = "1/2/file"
 
192
    def @path.call(n)
 
193
      pathmap_partial(n)
 
194
    end
 
195
    assert_equal("1", @path.call(1))
 
196
    assert_equal("1/2", @path.call(2))
 
197
    assert_equal("1/2", @path.call(3))
 
198
    assert_equal(".", @path.call(0))
 
199
    assert_equal("2", @path.call(-1))
 
200
    assert_equal("1/2", @path.call(-2))
 
201
    assert_equal("1/2", @path.call(-3))
 
202
  end
 
203
end
 
204
 
184
205
class TestFileListPathMap < Test::Unit::TestCase
185
206
  def test_file_list_supports_pathmap
186
207
    assert_equal ['a', 'b'], FileList['dir/a.rb', 'dir/b.rb'].pathmap("%n")