Пример #1
0
    def test_documentation_formatting(self):
        for typ, inp, default, doc in VARIABLES.values():
            self._verify_doc(doc)

        for attr, args, doc in FUNCTIONS.values():
            self._verify_doc(doc)

        for typ, doc in SPECIAL_VARIABLES.values():
            self._verify_doc(doc)
Пример #2
0
    def test_documentation_formatting(self):
        for typ, inp, doc, tier in VARIABLES.values():
            self._verify_doc(doc)

        for attr, args, doc in FUNCTIONS.values():
            self._verify_doc(doc)

        for typ, doc in SPECIAL_VARIABLES.values():
            self._verify_doc(doc)
Пример #3
0
    def test_symbol_presence(self):
        # Ensure no discrepancies between the master symbol table and what's in
        # the sandbox.
        sandbox = self.sandbox()

        all_symbols = set()
        all_symbols |= set(FUNCTIONS.keys())
        all_symbols |= set(SPECIAL_VARIABLES.keys())

        for symbol in sandbox:
            self.assertIn(symbol, all_symbols)
            all_symbols.remove(symbol)

        self.assertEqual(len(all_symbols), 0)
Пример #4
0
    def test_symbol_presence(self):
        # Ensure no discrepancies between the master symbol table and what's in
        # the sandbox.
        sandbox = self.sandbox()

        all_symbols = set()
        all_symbols |= set(FUNCTIONS.keys())
        all_symbols |= set(SPECIAL_VARIABLES.keys())

        for symbol in sandbox:
            self.assertIn(symbol, all_symbols)
            all_symbols.remove(symbol)

        self.assertEqual(len(all_symbols), 0)
    def reference(self, symbol, name_only=False):
        if name_only:
            for s in sorted(VARIABLES.keys()):
                print(s)

            for s in sorted(FUNCTIONS.keys()):
                print(s)

            for s in sorted(SPECIAL_VARIABLES.keys()):
                print(s)

            return 0

        if len(symbol):
            for s in symbol:
                if s in VARIABLES:
                    self.variable_reference(s)
                    continue
                elif s in FUNCTIONS:
                    self.function_reference(s)
                    continue
                elif s in SPECIAL_VARIABLES:
                    self.special_reference(s)
                    continue

                print('Could not find symbol: %s' % s)
                return 1

            return 0

        print('=========')
        print('VARIABLES')
        print('=========')
        print('')
        print('This section lists all the variables that may be set ')
        print('in moz.build files.')
        print('')

        for v in sorted(VARIABLES.keys()):
            self.variable_reference(v)

        print('=========')
        print('FUNCTIONS')
        print('=========')
        print('')
        print('This section lists all the functions that may be called ')
        print('in moz.build files.')
        print('')

        for f in sorted(FUNCTIONS.keys()):
            self.function_reference(f)

        print('=================')
        print('SPECIAL VARIABLES')
        print('=================')
        print('')

        for v in sorted(SPECIAL_VARIABLES.keys()):
            self.special_reference(v)

        return 0
Пример #6
0
    def reference(self, symbol, name_only=False):
        if name_only:
            for s in sorted(VARIABLES.keys()):
                print(s)

            for s in sorted(FUNCTIONS.keys()):
                print(s)

            for s in sorted(SPECIAL_VARIABLES.keys()):
                print(s)

            return 0

        if len(symbol):
            for s in symbol:
                if s in VARIABLES:
                    self.variable_reference(s)
                    continue
                elif s in FUNCTIONS:
                    self.function_reference(s)
                    continue
                elif s in SPECIAL_VARIABLES:
                    self.special_reference(s)
                    continue

                print('Could not find symbol: %s' % s)
                return 1

            return 0

        print('=========')
        print('VARIABLES')
        print('=========')
        print('')
        print('This section lists all the variables that may be set ')
        print('in moz.build files.')
        print('')

        for v in sorted(VARIABLES.keys()):
            self.variable_reference(v)

        print('=========')
        print('FUNCTIONS')
        print('=========')
        print('')
        print('This section lists all the functions that may be called ')
        print('in moz.build files.')
        print('')

        for f in sorted(FUNCTIONS.keys()):
            self.function_reference(f)

        print('=================')
        print('SPECIAL VARIABLES')
        print('=================')
        print('')

        for v in sorted(SPECIAL_VARIABLES.keys()):
            self.special_reference(v)

        return 0