#[cfg(all(test, feature = "test-conformance-xml"))]
use std::fs;
#[cfg(all(test, feature = "test-conformance-xml"))]
use xrust::item::Node;
#[cfg(all(test, feature = "test-conformance-xml"))]
use xrust::parser::{ParseError, xml};
#[cfg(all(test, feature = "test-conformance-xml"))]
use xrust::trees::smite::RNode;
#[cfg(all(test, feature = "test-conformance-xml"))]
fn test_eduni_xml11_error(xmldoc: &str) {
let testxml = RNode::new_document();
let parseresult = xml::parse(
testxml,
xmldoc,
Some(|_: &_| Err(ParseError::MissingNameSpace)),
);
assert!(parseresult.is_err());
}
#[cfg(all(test, feature = "test-conformance-xml"))]
use encoding_rs::UTF_8;
#[cfg(all(test, feature = "test-conformance-xml"))]
use encoding_rs::UTF_16BE;
#[cfg(all(test, feature = "test-conformance-xml"))]
use encoding_rs::UTF_16LE;
#[cfg(all(test, feature = "test-conformance-xml"))]
use encoding_rs::WINDOWS_1252;
#[cfg(all(test, feature = "test-conformance-xml"))]
use encoding_rs_io::DecodeReaderBytesBuilder;
#[cfg(all(test, feature = "test-conformance-xml"))]
use std::fs::File;
#[cfg(all(test, feature = "test-conformance-xml"))]
use std::io::{Read, Seek, SeekFrom};
#[cfg(all(test, feature = "test-conformance-xml"))]
pub fn non_utf8_file_reader(filedir: &str) -> String {
let mut file_in = File::open(filedir).unwrap();
let mut buffer = [0; 4];
let _ = file_in.read_exact(&mut buffer);
let _ = file_in.seek(SeekFrom::Start(0));
let enc = match buffer {
[254, 255, _, _] => Some(UTF_16BE), [255, 254, _, _] => Some(UTF_16LE), [239, 187, 191, _] => Some(UTF_8), [60, 63, 120, 109] => Some(WINDOWS_1252), _ => Some(UTF_8), };
let mut decoded_stream = DecodeReaderBytesBuilder::new().encoding(enc).build(file_in);
let mut dest = String::new();
let _ = decoded_stream.read_to_string(&mut dest);
dest
}
#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmt008() {
test_eduni_xml11_error(
fs::read_to_string("tests/conformance/xml/xmlconf/eduni/xml-1.1/008.xml")
.unwrap()
.as_str(),
);
}
#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmt009() {
test_eduni_xml11_error(
fs::read_to_string("tests/conformance/xml/xmlconf/eduni/xml-1.1/009.xml")
.unwrap()
.as_str(),
);
}
#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmt055() {
test_eduni_xml11_error(
non_utf8_file_reader("tests/conformance/xml/xmlconf/eduni/xml-1.1/055.xml").as_str(),
);
}
#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmt056() {
test_eduni_xml11_error(
fs::read_to_string("tests/conformance/xml/xmlconf/eduni/xml-1.1/056.xml")
.unwrap()
.as_str(),
);
}
#[test]
#[cfg(all(test, feature = "test-conformance-xml"))]
fn rmt057() {
test_eduni_xml11_error(
fs::read_to_string("tests/conformance/xml/xmlconf/eduni/xml-1.1/057.xml")
.unwrap()
.as_str(),
);
}