/*

Richard Tobin's XML Namespaces 1.0 test suite 14 Feb 2003

*/

#[cfg(all(test, feature = "test-conformance-xml"))]
use qualname::NamespacePrefix;
#[cfg(all(test, feature = "test-conformance-xml"))]
use std::fs;
#[cfg(all(test, feature = "test-conformance-xml"))]
use chadpath::item::Node;
#[cfg(all(test, feature = "test-conformance-xml"))]
use chadpath::parser::{ParseError, xml};
#[cfg(all(test, feature = "test-conformance-xml"))]
use chadpath::trees::smite::RNode;

#[cfg(all(test, feature = "test-conformance-xml"))]
fn test_eduni_namespaces_10_notwf(xmldoc: &str) {
    let testxml = RNode::new_document();
    let parseresult = xml::parse(
        testxml,
        xmldoc,
        Some(|p: &NamespacePrefix| {
            eprintln!("resolve ns prefix {}", p.to_string());
            Err(ParseError::MissingNameSpace)
        }),
    );

    assert!(parseresult.is_err());
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10009() {
    /*
        Test ID:rmt-ns10-009
        Test URI:009.xml
        Spec Sections:1
        Description:Namespace equality test: plain repetition
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/009.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10010() {
    /*
        Test ID:rmt-ns10-010
        Test URI:010.xml
        Spec Sections:1
        Description:Namespace equality test: use of character reference
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/010.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10011() {
    /*
        Test ID:rmt-ns10-011
        Test URI:011.xml
        Spec Sections:1
        Description:Namespace equality test: use of entity reference
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/011.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10012() {
    /*
        Test ID:rmt-ns10-012
        Test URI:012.xml
        Spec Sections:1
        Description:Namespace inequality test: equal after attribute value normalization
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/012.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10013() {
    /*
        Test ID:rmt-ns10-013
        Test URI:013.xml
        Spec Sections:3
        Description:Bad QName syntax: multiple colons
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/013.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10014() {
    /*
        Test ID:rmt-ns10-014
        Test URI:014.xml
        Spec Sections:3
        Description:Bad QName syntax: colon at end
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/014.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10015() {
    /*
        Test ID:rmt-ns10-015
        Test URI:015.xml
        Spec Sections:3
        Description:Bad QName syntax: colon at start
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/015.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10016() {
    /*
        Test ID:rmt-ns10-016
        Test URI:016.xml
        Spec Sections:2
        Description:Bad QName syntax: xmlns:
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/016.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10023() {
    /*
        Test ID:rmt-ns10-023
        Test URI:023.xml
        Spec Sections:2
        Description:Illegal use of 1.1-style prefix unbinding in 1.0 document
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/023.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10025() {
    /*
        Test ID:rmt-ns10-025
        Test URI:025.xml
        Spec Sections:4
        Description:Unbound element prefix
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/025.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10026() {
    /*
        Test ID:rmt-ns10-026
        Test URI:026.xml
        Spec Sections:4
        Description:Unbound attribute prefix
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/026.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10029() {
    /*
        Test ID:rmt-ns10-029
        Test URI:029.xml
        Spec Sections:NE05
        Description:Reserved prefixes and namespaces: declaring the xml prefix incorrectly
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/029.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10030() {
    /*
        Test ID:rmt-ns10-030
        Test URI:030.xml
        Spec Sections:NE05
        Description:Reserved prefixes and namespaces: binding another prefix to the xml namespace
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/030.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10031() {
    /*
        Test ID:rmt-ns10-031
        Test URI:031.xml
        Spec Sections:NE05
        Description:Reserved prefixes and namespaces: declaring the xmlns prefix with its correct URI (illegal)
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/031.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10032() {
    /*
        Test ID:rmt-ns10-032
        Test URI:032.xml
        Spec Sections:NE05
        Description:Reserved prefixes and namespaces: declaring the xmlns prefix with an incorrect URI
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/032.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10033() {
    /*
        Test ID:rmt-ns10-033
        Test URI:033.xml
        Spec Sections:NE05
        Description:Reserved prefixes and namespaces: binding another prefix to the xmlns namespace
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/033.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10035() {
    /*
        Test ID:rmt-ns10-035
        Test URI:035.xml
        Spec Sections:5.3
        Description:Attribute uniqueness: repeated identical attribute
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/035.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10036() {
    /*
        Test ID:rmt-ns10-036
        Test URI:036.xml
        Spec Sections:5.3
        Description:Attribute uniqueness: repeated attribute with different prefixes
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/036.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10042() {
    /*
        Test ID:rmt-ns10-042
        Test URI:042.xml
        Spec Sections:NE08
        Description:Colon in PI name
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/042.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10043() {
    /*
        Test ID:rmt-ns10-043
        Test URI:043.xml
        Spec Sections:NE08
        Description:Colon in entity name
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/043.xml")
            .unwrap()
            .as_str(),
    );
}

#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmtns10044() {
    /*
        Test ID:rmt-ns10-044
        Test URI:044.xml
        Spec Sections:NE08
        Description:Colon in entity name
    */

    test_eduni_namespaces_10_notwf(
        fs::read_to_string("tests/conformance/xml/xmlconf/eduni/namespaces/1.0/044.xml")
            .unwrap()
            .as_str(),
    );
}
