/* James Clark XMLTEST cases - Standalone This contains cases that are valid XML documents. */ use std::fs; use xrust::item::Node; use xrust::parser::xml; use xrust::trees::smite::RNode; #[test] fn validsa001() { /* Test ID:valid-sa-001 Test URI:valid/sa/001.xml Spec Sections:3.2.2 [51] Description:Test demonstrates an Element Type Declaration with Mixed Content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/001.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa002() { /* Test ID:valid-sa-002 Test URI:valid/sa/002.xml Spec Sections:3.1 [40] Description:Test demonstrates that whitespace is permitted after the tag name in a Start-tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/002.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa003() { /* Test ID:valid-sa-003 Test URI:valid/sa/003.xml Spec Sections:3.1 [42] Description:Test demonstrates that whitespace is permitted after the tag name in an End-tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/003.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa004() { /* Test ID:valid-sa-004 Test URI:valid/sa/004.xml Spec Sections:3.1 [41] Description:Test demonstrates a valid attribute specification within a Start-tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/004.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa005() { /* Test ID:valid-sa-005 Test URI:valid/sa/005.xml Spec Sections:3.1 [40] Description:Test demonstrates a valid attribute specification within a Start-tag thatcontains whitespace on both sides of the equal sign. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/005.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa006() { /* Test ID:valid-sa-006 Test URI:valid/sa/006.xml Spec Sections:3.1 [41] Description:Test demonstrates that the AttValue within a Start-tag can use a single quote as a delimter. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/006.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa007() { /* Test ID:valid-sa-007 Test URI:valid/sa/007.xml Spec Sections:3.1 4.6 [43] Description:Test demonstrates numeric character references can be used for element content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/007.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa008() { /* Test ID:valid-sa-008 Test URI:valid/sa/008.xml Spec Sections:2.4 3.1 [43] Description:Test demonstrates character references can be used for element content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/008.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa009() { /* Test ID:valid-sa-009 Test URI:valid/sa/009.xml Spec Sections:2.3 3.1 [43] Description:Test demonstrates that PubidChar can be used for element content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/009.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa010() { /* Test ID:valid-sa-010 Test URI:valid/sa/010.xml Spec Sections:3.1 [40] Description:Test demonstrates that whitespace is valid after the Attribute in a Start-tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/010.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa011() { /* Test ID:valid-sa-011 Test URI:valid/sa/011.xml Spec Sections:3.1 [40] Description:Test demonstrates mutliple Attibutes within the Start-tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/011.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } /* #[test] #[ignore] fn validsa012() { /* This test is deliberately ignored. Although these are valid XML documents, XML without namespaces is not something we wish to handle. */ /* Test ID:valid-sa-012 Test URI:valid/sa/012.xml Spec Sections:2.3 [4] Description:Uses a legal XML 1.0 name consisting of a single colon character (disallowed by the latest XML Namespaces draft). */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/012.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } */ #[test] fn validsa013() { /* Test ID:valid-sa-013 Test URI:valid/sa/013.xml Spec Sections:2.3 3.1 [13] [40] Description:Test demonstrates that the Attribute in a Start-tag can consist of numerals along with special characters. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/013.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa014() { /* Test ID:valid-sa-014 Test URI:valid/sa/014.xml Spec Sections:2.3 3.1 [13] [40] Description:Test demonstrates that all lower case letters are valid for the Attribute in a Start-tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/014.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa015() { /* Test ID:valid-sa-015 Test URI:valid/sa/015.xml Spec Sections:2.3 3.1 [13] [40] Description:Test demonstrates that all upper case letters are valid for the Attribute in a Start-tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/015.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa016() { /* Test ID:valid-sa-016 Test URI:valid/sa/016.xml Spec Sections:2.6 3.1 [16] [43] Description:Test demonstrates that Processing Instructions are valid element content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/016.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa017() { /* Test ID:valid-sa-017 Test URI:valid/sa/017.xml Spec Sections:2.6 3.1 [16] [43] Description:Test demonstrates that Processing Instructions are valid element content and there can be more than one. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/017.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa018() { /* Test ID:valid-sa-018 Test URI:valid/sa/018.xml Spec Sections:2.7 3.1 [18] [43] Description:Test demonstrates that CDATA sections are valid element content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/018.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa019() { /* Test ID:valid-sa-019 Test URI:valid/sa/019.xml Spec Sections:2.7 3.1 [18] [43] Description:Test demonstrates that CDATA sections are valid element content and thatampersands may occur in their literal form. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/019.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa020() { /* Test ID:valid-sa-020 Test URI:valid/sa/020.xml Spec Sections:2.7 3.1 [18] [43] Description:Test demonstractes that CDATA sections are valid element content and thateveryting between the CDStart and CDEnd is recognized as character data not markup. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/020.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa021() { /* Test ID:valid-sa-021 Test URI:valid/sa/021.xml Spec Sections:2.5 3.1 [15] [43] Description:Test demonstrates that comments are valid element content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/021.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa022() { /* Test ID:valid-sa-022 Test URI:valid/sa/022.xml Spec Sections:2.5 3.1 [15] [43] Description:Test demonstrates that comments are valid element content and that all characters before the double-hypen right angle combination are considered part of thecomment. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/022.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa023() { /* Test ID:valid-sa-023 Test URI:valid/sa/023.xml Spec Sections:3.1 [43] Description:Test demonstrates that Entity References are valid element content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/023.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa024() { /* Test ID:valid-sa-024 Test URI:valid/sa/024.xml Spec Sections:3.1 4.1 [43] [66] Description:Test demonstrates that Entity References are valid element content and also demonstrates a valid Entity Declaration. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/024.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa025() { /* Test ID:valid-sa-025 Test URI:valid/sa/025.xml Spec Sections:3.2 [46] Description:Test demonstrates an Element Type Declaration and that the contentspec can be of mixed content. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/025.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa026() { /* Test ID:valid-sa-026 Test URI:valid/sa/026.xml Spec Sections:3.2 [46] Description:Test demonstrates an Element Type Declaration and that EMPTY is a valid contentspec. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/026.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa027() { /* Test ID:valid-sa-027 Test URI:valid/sa/027.xml Spec Sections:3.2 [46] Description:Test demonstrates an Element Type Declaration and that ANY is a valid contenspec. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/027.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa028() { /* Test ID:valid-sa-028 Test URI:valid/sa/028.xml Spec Sections:2.8 [24] Description:Test demonstrates a valid prolog that uses double quotes as delimeters around the VersionNum. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/028.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa029() { /* Test ID:valid-sa-029 Test URI:valid/sa/029.xml Spec Sections:2.8 [24] Description:Test demonstrates a valid prolog that uses single quotes as delimters around the VersionNum. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/029.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa030() { /* Test ID:valid-sa-030 Test URI:valid/sa/030.xml Spec Sections:2.8 [25] Description:Test demonstrates a valid prolog that contains whitespace on both sides of the equal sign in the VersionInfo. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/030.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa031() { /* Test ID:valid-sa-031 Test URI:valid/sa/031.xml Spec Sections:4.3.3 [80] Description:Test demonstrates a valid EncodingDecl within the prolog. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/031.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa032() { /* Test ID:valid-sa-032 Test URI:valid/sa/032.xml Spec Sections:2.9 [32] Description:Test demonstrates a valid SDDecl within the prolog. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/032.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa033() { /* Test ID:valid-sa-033 Test URI:valid/sa/033.xml Spec Sections:2.8 [23] Description:Test demonstrates that both a EncodingDecl and SDDecl are valid within the prolog. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/033.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa034() { /* Test ID:valid-sa-034 Test URI:valid/sa/034.xml Spec Sections:3.1 [44] Description:Test demonstrates the correct syntax for an Empty element tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/034.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa035() { /* Test ID:valid-sa-035 Test URI:valid/sa/035.xml Spec Sections:3.1 [44] Description:Test demonstrates that whitespace is permissible after the name in an Empty element tag. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/035.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa036() { /* Test ID:valid-sa-036 Test URI:valid/sa/036.xml Spec Sections:2.6 [16] Description:Test demonstrates a valid processing instruction. */ let testxml = RNode::new_document(); let parseresult = xml::parse( testxml, fs::read_to_string("tests/conformance/xml/xmlconf/xmltest/valid/sa/out/036.xml") .unwrap() .as_str(), None, ); assert!(parseresult.is_ok()); } #[test] fn validsa017a() { /* Test ID:valid-sa-017a Test URI:valid/sa/017a.xml Spec Sections:2.6 3.1 [16] [43] Description:Test demonstrates that two apparently wrong Processing Instructions make aright one, with very odd content "some data ? >