Ejemplo n.º 1
0
 def test_with_main_description_rest(self):
     description = InstructionDocumentationWithConstantValues('instruction name',
                                                              'single line description',
                                                              'main description rest',
                                                              [])
     actual = sut.instruction_doc_section_contents_constructor(description).apply(CONSTRUCTION_ENVIRONMENT)
     struct_check.is_section_contents.apply(self, actual)
Ejemplo n.º 2
0
 def test_with_invokation_variants(self):
     description = InstructionDocumentationWithConstantValues(
         'instruction name',
         'single line description',
         'main description rest',
         [InvokationVariant('invokation variant syntax',
                            paras('invokation variant description rest'))])
     actual = sut.instruction_doc_section_contents_constructor(description).apply(CONSTRUCTION_ENVIRONMENT)
     struct_check.is_section_contents.apply(self, actual)
Ejemplo n.º 3
0
 def apply(self, environment: ConstructionEnvironment) -> doc.SectionContents:
     sections = []
     for phase_and_instruction_description in self.phase_and_instruction_description_list:
         man_page_renderer = render_instruction.instruction_doc_section_contents_constructor(
             phase_and_instruction_description[1])
         phase_section = doc.Section(text(phase_and_instruction_description[0].syntax),
                                     man_page_renderer.apply(environment))
         sections.append(phase_section)
     initial_paragraphs = []
     if len(self.phase_and_instruction_description_list) > 1:
         initial_paragraphs = [para('The instruction "%s" exists in multiple phases.' % self.instruction_name)]
     return doc.SectionContents(initial_paragraphs, sections)
Ejemplo n.º 4
0
 def test_with_main_description_rest_sub_sections(self):
     description = InstructionDocumentationWithConstantValues(
         'instruction name',
         'single line description',
         'main description rest',
         [],
         main_description_rest_sub_sections=[
             docs.section('main description rest sub section header',
                          docs.paras('Sub section paragraphs'))
         ]
     )
     actual = sut.instruction_doc_section_contents_constructor(description).apply(CONSTRUCTION_ENVIRONMENT)
     struct_check.is_section_contents.apply(self, actual)
Ejemplo n.º 5
0
 def apply(self,
           environment: ConstructionEnvironment) -> doc.SectionContents:
     sections = []
     for phase_and_instruction_description in self.phase_and_instruction_description_list:
         man_page_renderer = render_instruction.instruction_doc_section_contents_constructor(
             phase_and_instruction_description[1])
         phase_section = doc.Section(
             text(phase_and_instruction_description[0].syntax),
             man_page_renderer.apply(environment))
         sections.append(phase_section)
     initial_paragraphs = []
     if len(self.phase_and_instruction_description_list) > 1:
         initial_paragraphs = [
             para('The instruction "%s" exists in multiple phases.' %
                  self.instruction_name)
         ]
     return doc.SectionContents(initial_paragraphs, sections)