mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
ce0ce6fa4e
Summary: Move the code for the command-line tool up one directory, out of eden/fs. This better separates the code so that eden/fs contains code for the edenfs daemon, while eden/cli contains code for the command line tool. Reviewed By: bolinfest Differential Revision: D4888633 fbshipit-source-id: 5041e292c5353d05122eefe5db3257289e31239a
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
# Copyright (c) 2017-present, Facebook, Inc.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the BSD-style license found in the
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
from __future__ import absolute_import
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
from __future__ import unicode_literals
|
|
from .. import configinterpolator
|
|
import configparser
|
|
import unittest
|
|
|
|
|
|
class InterpolatorTest(unittest.TestCase):
|
|
def test_basic_subs(self):
|
|
defaults = {'USER': 'wez', 'RECURSIVE': 'a${RECURSIVE}b'}
|
|
parser = configparser.ConfigParser(
|
|
interpolation=configinterpolator.EdenConfigInterpolator(defaults))
|
|
parser.add_section('section')
|
|
parser.set('section', 'user', '${USER}')
|
|
parser.set('section', 'rec', '${RECURSIVE}')
|
|
parser.set('section', 'simple', 'value')
|
|
|
|
self.assertEqual('wez', parser.get('section', 'user'))
|
|
self.assertEqual('value', parser.get('section', 'simple'))
|
|
self.assertEqual('a${RECURSIVE}b', parser.get('section', 'rec'))
|
|
|
|
actual = {}
|
|
for section in parser.sections():
|
|
actual[section] = dict(parser.items(section))
|
|
|
|
expect = {
|
|
'section': {
|
|
'user': 'wez',
|
|
'simple': 'value',
|
|
'rec': 'a${RECURSIVE}b',
|
|
}
|
|
}
|
|
self.assertEqual(expect, actual)
|