quickfix-spec-parser 0.2.1

FIX XML spec file parser / writer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use quick_xml::events::BytesStart;
use quickfix_spec_parser::{read_attribute, FixSpecError};

#[test]
fn test_read_attributes() {
    let div =
        BytesStart::new("div").with_attributes([(b"class".as_slice(), b"test-me".as_slice())]);

    // Check valid.
    assert_eq!(read_attribute(&div, "class").as_deref(), Ok("test-me"));

    // Check not found.
    assert_eq!(
        read_attribute(&div, "style"),
        Err(FixSpecError::InvalidAttribute("style".to_string()))
    );
}