Mercurial > hg
comparison tests/test-run-tests.py @ 35381:14fd435763ee
run-tests: suggest a (glob) for os.path.sep mismatches with '\r\n' EOL too
We already do this for lines ending in '\n', such that the test only needs to be
run with --interactive and the changes accepted at the end. But that wasn't
working with list-tree.py output for example, and required manual fixup.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 10 Dec 2017 00:00:36 -0500 |
parents | 2e43c5cd57a7 |
children | dfae14354660 |
comparison
equal
deleted
inserted
replaced
35380:acff41957b34 | 35381:14fd435763ee |
---|---|
52 r"""test matching like running on windows | 52 r"""test matching like running on windows |
53 | 53 |
54 enable windows matching on any os | 54 enable windows matching on any os |
55 >>> _osaltsep = os.altsep | 55 >>> _osaltsep = os.altsep |
56 >>> os.altsep = True | 56 >>> os.altsep = True |
57 >>> _osname = os.name | |
58 >>> os.name = 'nt' | |
57 | 59 |
58 valid match on windows | 60 valid match on windows |
59 >>> lm(b'g/a*/d (glob)\n', b'g\\abc/d\n') | 61 >>> lm(b'g/a*/d (glob)\n', b'g\\abc/d\n') |
60 True | 62 True |
61 | 63 |
64 'special: -glob' | 66 'special: -glob' |
65 | 67 |
66 missing glob | 68 missing glob |
67 >>> lm(b'/g/c/d/fg\n', b'\\g\\c\\d/fg\n') | 69 >>> lm(b'/g/c/d/fg\n', b'\\g\\c\\d/fg\n') |
68 'special: +glob' | 70 'special: +glob' |
71 >>> lm(b'/g/c/d/fg\n', b'\\g\\c\\d\\fg\r\n') | |
72 'special: +glob' | |
69 | 73 |
70 restore os.altsep | 74 restore os.altsep |
71 >>> os.altsep = _osaltsep | 75 >>> os.altsep = _osaltsep |
76 >>> os.name = _osname | |
72 """ | 77 """ |
73 pass | 78 pass |
74 | 79 |
75 def otherostests(): | 80 def otherostests(): |
76 r"""test matching like running on non-windows os | 81 r"""test matching like running on non-windows os |
77 | 82 |
78 disable windows matching on any os | 83 disable windows matching on any os |
79 >>> _osaltsep = os.altsep | 84 >>> _osaltsep = os.altsep |
80 >>> os.altsep = False | 85 >>> os.altsep = False |
86 >>> _osname = os.name | |
87 >>> os.name = 'nt' | |
81 | 88 |
82 backslash does not match slash | 89 backslash does not match slash |
83 >>> lm(b'h/a* (glob)\n', b'h\\ab\n') | 90 >>> lm(b'h/a* (glob)\n', b'h\\ab\n') |
84 False | 91 False |
85 | 92 |
91 >>> lm(b'/h/c/df/g/\n', b'\\h/c\\df/g\\\n') | 98 >>> lm(b'/h/c/df/g/\n', b'\\h/c\\df/g\\\n') |
92 False | 99 False |
93 | 100 |
94 restore os.altsep | 101 restore os.altsep |
95 >>> os.altsep = _osaltsep | 102 >>> os.altsep = _osaltsep |
103 >>> os.name = _osname | |
96 """ | 104 """ |
97 pass | 105 pass |
98 | 106 |
99 if __name__ == '__main__': | 107 if __name__ == '__main__': |
100 doctest.testmod() | 108 doctest.testmod() |