Exemple #1
0
    def _run_test(self, input_text, expected_text):
        """Parses input, renders it and compares the results"""
        parser = idlparser.IDLParser(idlparser.FREMONTCUT_SYNTAX)
        idl_file = idlnode.IDLFile(parser.parse(input_text))
        output_text = idlrenderer.render(idl_file)

        if output_text != expected_text:
            msg = '''
EXPECTED:
%s
ACTUAL  :
%s
''' % (expected_text, output_text)
            self.fail(msg)
Exemple #2
0
  def _run_test(self, input_text, expected_text):
    """Parses input, renders it and compares the results"""
    parser = idlparser.IDLParser(idlparser.FREMONTCUT_SYNTAX)
    idl_file = idlnode.IDLFile(parser.parse(input_text))
    output_text = idlrenderer.render(idl_file)

    if output_text != expected_text:
      msg = '''
EXPECTED:
%s
ACTUAL  :
%s
''' % (expected_text, output_text)
      self.fail(msg)
Exemple #3
0
    def _SaveInterfaceFile(self, interface):
        """Saves an interface into the database.

    Args:
      interface -- an IDLInterface instance.
    """

        interface_name = interface.id

        # Actual saving
        file_path = self._FilePath(interface_name)
        _logger.debug('writing %s' % file_path)

        dir_name = os.path.dirname(file_path)
        if not os.path.exists(dir_name):
            _logger.debug('creating directory %s' % dir_name)
            os.mkdir(dir_name)

        # Render the IDLInterface object into text.
        text = idlrenderer.render(interface)

        f = open(file_path, 'w')
        f.write(text)
        f.close()
Exemple #4
0
  def _SaveInterfaceFile(self, interface):
    """Saves an interface into the database.

    Args:
      interface -- an IDLInterface instance.
    """

    interface_name = interface.id

    # Actual saving
    file_path = self._FilePath(interface_name)
    _logger.debug('writing %s' % file_path)

    dir_name = os.path.dirname(file_path)
    if not os.path.exists(dir_name):
      _logger.debug('creating directory %s' % dir_name)
      os.mkdir(dir_name)

    # Render the IDLInterface object into text.
    text = idlrenderer.render(interface)

    f = open(file_path, 'w')
    f.write(text)
    f.close()