Mercurial > hg
changeset 32846:7c11869cf23a
tests: add test coverage for check-config
We didn't have explicit test coverage before. I broke check-config.py
as part of writing patches and was lucky I realized it.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 15 Jun 2017 10:46:39 -0700 |
parents | 58a6f64a7018 |
children | e5a6a540ae63 |
files | tests/test-check-config.t |
diffstat | 1 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-check-config.t Thu Jun 15 22:57:20 2017 -0700 +++ b/tests/test-check-config.t Thu Jun 15 10:46:39 2017 -0700 @@ -1,8 +1,34 @@ #require test-repo $ . "$TESTDIR/helpers-testrepo.sh" + +Sanity check check-config.py + + $ cat > testfile.py << EOF + > # Good + > foo = ui.config('ui', 'username') + > # Missing + > foo = ui.config('ui', 'doesnotexist') + > # Missing different type + > foo = ui.configint('ui', 'missingint') + > # Missing with default value + > foo = ui.configbool('ui', 'missingbool1', default=True) + > foo = ui.configbool('ui', 'missingbool2', False) + > EOF + + $ cat > files << EOF + > mercurial/help/config.txt + > $TESTTMP/testfile.py + > EOF + $ cd "$TESTDIR"/.. + $ python contrib/check-config.py < $TESTTMP/files + undocumented: ui.doesnotexist (str) + undocumented: ui.missingbool1 (bool) [True] + undocumented: ui.missingbool2 (bool) + undocumented: ui.missingint (int) + New errors are not allowed. Warnings are strongly discouraged. $ hg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |