diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-04-03 09:06:38 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-04-03 09:06:38 -0700 |
commit | c521bc87db7daf70a6c00272c6c7440059135b58 (patch) | |
tree | 19fc0afa24a678c92eb961e2cadcc008da85d24a | |
parent | 318893ddf8cdcf778e7ba6a49f3ad062af19bdf9 (diff) | |
download | portage-c521bc87db7daf70a6c00272c6c7440059135b58.tar.gz portage-c521bc87db7daf70a6c00272c6c7440059135b58.tar.bz2 portage-c521bc87db7daf70a6c00272c6c7440059135b58.zip |
test_getconfig: add case for bug #410625
-rw-r--r-- | pym/portage/tests/util/test_getconfig.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/pym/portage/tests/util/test_getconfig.py b/pym/portage/tests/util/test_getconfig.py index 00f7f52e2..f13b75358 100644 --- a/pym/portage/tests/util/test_getconfig.py +++ b/pym/portage/tests/util/test_getconfig.py @@ -1,7 +1,10 @@ -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import tempfile + from portage import os +from portage import _unicode_encode from portage.const import PORTAGE_BASE_PATH from portage.tests import TestCase from portage.util import getconfig @@ -27,3 +30,24 @@ class GetConfigTestCase(TestCase): d = getconfig(make_globals_file) for k, v in self._cases.items(): self.assertEqual(d[k], v) + + def testGetConfigProfileEnv(self): + # Test the mode which is used to parse /etc/env.d and /etc/profile.env. + + cases = { + 'LESS_TERMCAP_mb': "$\E[01;31m", # bug #410625 + } + + with tempfile.NamedTemporaryFile(mode='wb') as f: + # Format like env_update formats /etc/profile.env. + for k, v in cases.items(): + if v.startswith('$') and not v.startswith('${'): + line = "export %s=$'%s'\n" % (k, v[1:]) + else: + line = "export %s='%s'\n" % (k, v) + f.write(_unicode_encode(line)) + f.flush() + + d = getconfig(f.name, expand=False) + for k, v in cases.items(): + self.assertEqual(d.get(k), v) |