| 1 |
import unittest |
| 2 |
|
| 3 |
import silenttestrunner |
| 4 |
|
| 5 |
from mercurial import pathutil |
| 6 |
|
| 7 |
|
| 8 |
class dirstests(unittest.TestCase): |
| 9 |
def testdirs(self): |
| 10 |
for case, want in [ |
| 11 |
(b'a/a/a', [b'a', b'a/a', b'']), |
| 12 |
(b'alpha/beta/gamma', [b'', b'alpha', b'alpha/beta']), |
| 13 |
]: |
| 14 |
d = pathutil.dirs([]) |
| 15 |
d.addpath(case) |
| 16 |
self.assertEqual(sorted(d), sorted(want)) |
| 17 |
|
| 18 |
def testinvalid(self): |
| 19 |
with self.assertRaises(ValueError): |
| 20 |
d = pathutil.dirs([]) |
| 21 |
d.addpath(b'a//b') |
| 22 |
|
| 23 |
|
| 24 |
if __name__ == '__main__': |
| 25 |
silenttestrunner.main(__name__) |