foxy_test_indent_tag Program

Uses

  • program~~foxy_test_indent_tag~~UsesGraph program~foxy_test_indent_tag foxy_test_indent_tag module~foxy foxy program~foxy_test_indent_tag->module~foxy module~foxy_xml_file foxy_xml_file module~foxy->module~foxy_xml_file module~foxy_xml_tag foxy_xml_tag module~foxy->module~foxy_xml_tag penf penf module~foxy->penf module~foxy_xml_file->module~foxy_xml_tag module~foxy_xml_file->penf module~foxy_xml_tag->penf stringifor stringifor module~foxy_xml_tag->stringifor

FoXy test.


Calls

program~~foxy_test_indent_tag~~CallsGraph program~foxy_test_indent_tag foxy_test_indent_tag proc~stringify xml_tag%stringify program~foxy_test_indent_tag->proc~stringify chars chars proc~stringify->chars is_allocated is_allocated proc~stringify->is_allocated proc~end_tag xml_tag%end_tag proc~stringify->proc~end_tag proc~self_closing_tag xml_tag%self_closing_tag proc~stringify->proc~self_closing_tag proc~start_tag xml_tag%start_tag proc~stringify->proc~start_tag

Variables

Type Attributes Name Initial
character(len=:), allocatable :: source

String containing the source XML data.

character(len=:), allocatable :: parsed

String containing the parsed XML data.

type(xml_tag) :: a_tag

XML tag handler.

logical :: test_passed(2)

List of passed tests.


Source Code

program foxy_test_indent_tag
!< FoXy test.
use foxy, only: xml_tag

implicit none
character(len=:), allocatable :: source         !< String containing the source XML data.
character(len=:), allocatable :: parsed         !< String containing the parsed XML data.
type(xml_tag)                 :: a_tag          !< XML tag handler.
logical                       :: test_passed(2) !< List of passed tests.

test_passed = .false.

print "(A)", 'source'
source = '  <first>lorem ipsum...</first>'
print "(A)", source
print "(A)", 'created'
a_tag = xml_tag(name='first', content='lorem ipsum...', indent=2)
parsed = a_tag%stringify(is_indented=.true.)
test_passed(1) = trim(adjustl(source))==trim(adjustl(parsed))
print "(A,L1)", parsed//' Is correct? ', test_passed(1)

print "(A)", 'source'
source = '  <first>'//new_line('a')//          &
         '    lorem ipsum...'//new_line('a')// &
         '  </first>'
print "(A)", source
print "(A)", 'created'
a_tag = xml_tag(name='first', content='lorem ipsum...', indent=2)
parsed = a_tag%stringify(is_indented=.true., is_content_indented=.true.)
test_passed(2) = trim(adjustl(source))==trim(adjustl(parsed))
print "(A,L1)", parsed//' Is correct? ', test_passed(2)

print "(A,L1)", new_line('a')//'Are all tests passed? ', all(test_passed)
endprogram foxy_test_indent_tag