##// END OF EJS Templates
rhg: add resolve_file_args to path_utils.rs...
rhg: add resolve_file_args to path_utils.rs Extracted logic for resolving `FILE ...` arguments from cat.rs into a new function in path_utils.rs. I plan to use this for rhg annotate. I tried to reuse hg::utils::files::canonical_path instead, but that didn't work. For example it reports a InsideDotHg error for any path containing "..".

File last commit:

r52596:ca7bde5d default
r53438:f33f37ac tip default
Show More
test-hg-parseurl.py
51 lines | 1.6 KiB | text/x-python | PythonLexer
/ tests / test-hg-parseurl.py
Augie Fackler
tests: port test-hg-parseurl.py to unittest...
r37731 import unittest
urlutil: extract `parseurl` from `hg` into the new module...
r47670 from mercurial.utils import urlutil
Augie Fackler
formatting: blacken the codebase...
r43346
Martijn Pieters
hg: allow hg.parseurl(url, None)...
r8174
Augie Fackler
tests: port test-hg-parseurl.py to unittest...
r37731 class ParseRequestTests(unittest.TestCase):
def testparse(self):
Augie Fackler
formatting: blacken the codebase...
r43346 self.assertEqual(
urlutil: extract `parseurl` from `hg` into the new module...
r47670 urlutil.parseurl(b'http://example.com/no/anchor'),
Augie Fackler
formatting: blacken the codebase...
r43346 (b'http://example.com/no/anchor', (None, [])),
)
self.assertEqual(
urlutil: extract `parseurl` from `hg` into the new module...
r47670 urlutil.parseurl(b'http://example.com/an/anchor#foo'),
Augie Fackler
formatting: blacken the codebase...
r43346 (b'http://example.com/an/anchor', (b'foo', [])),
)
Augie Fackler
tests: port test-hg-parseurl.py to unittest...
r37731 self.assertEqual(
urlutil: extract `parseurl` from `hg` into the new module...
r47670 urlutil.parseurl(
b'http://example.com/no/anchor/branches', [b'foo']
),
Augie Fackler
formatting: blacken the codebase...
r43346 (b'http://example.com/no/anchor/branches', (None, [b'foo'])),
)
Augie Fackler
tests: port test-hg-parseurl.py to unittest...
r37731 self.assertEqual(
urlutil: extract `parseurl` from `hg` into the new module...
r47670 urlutil.parseurl(
b'http://example.com/an/anchor/branches#bar', [b'foo']
),
Augie Fackler
formatting: blacken the codebase...
r43346 (b'http://example.com/an/anchor/branches', (b'bar', [b'foo'])),
)
self.assertEqual(
urlutil: extract `parseurl` from `hg` into the new module...
r47670 urlutil.parseurl(
Augie Fackler
formatting: blacken the codebase...
r43346 b'http://example.com/an/anchor/branches-None#foo', None
),
(b'http://example.com/an/anchor/branches-None', (b'foo', [])),
)
self.assertEqual(
urlutil: extract `parseurl` from `hg` into the new module...
r47670 urlutil.parseurl(b'http://example.com/'),
Augie Fackler
formatting: blacken the codebase...
r43346 (b'http://example.com/', (None, [])),
)
self.assertEqual(
urlutil: extract `parseurl` from `hg` into the new module...
r47670 urlutil.parseurl(b'http://example.com'),
Augie Fackler
formatting: blacken the codebase...
r43346 (b'http://example.com/', (None, [])),
)
self.assertEqual(
urlutil: extract `parseurl` from `hg` into the new module...
r47670 urlutil.parseurl(b'http://example.com#foo'),
Augie Fackler
formatting: blacken the codebase...
r43346 (b'http://example.com/', (b'foo', [])),
)
Augie Fackler
tests: port test-hg-parseurl.py to unittest...
r37731
if __name__ == '__main__':
import silenttestrunner
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
tests: port test-hg-parseurl.py to unittest...
r37731 silenttestrunner.main(__name__)