Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Fix attribute parsing #4

Merged
merged 8 commits into from May 8, 2022
Merged

Fix attribute parsing #4

merged 8 commits into from May 8, 2022

Commits on May 8, 2022

  1. Group all attribute-related methods in one impl block

    Also fix incorrect references to `Attributes` instead of `Attribute`
    Mingun committed May 8, 2022
    Copy the full SHA
    bddd1a6 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    149635a View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    6b82fc3 View commit details
    Browse the repository at this point in the history
  4. Error kind NameWithQuote never triggered, remove it

    .find(|&(_, &b)| b == b'=' || is_whitespace(b))
    
    cannot return Some((_, b'"')) or Some((_, b'\'')) because `"` and `'` are not whitespaces
    Mingun committed May 8, 2022
    Copy the full SHA
    e7dda45 View commit details
    Browse the repository at this point in the history
  5. Use dedicated comparable error type for attribute parsing errors

    Because iterator over attributes is recovering, user can want to inspect
    possible errors and filtering out irrelevant errors should help him
    
    Co-authored-by: Daniel Alley <dalley@redhat.com>
    Mingun and dralley committed May 8, 2022
    Copy the full SHA
    f93259a View commit details
    Browse the repository at this point in the history
  6. Use AttrError in the Attributes iterator return type

    Because now error type is PartialEq, we can use `assert_eq!` directly,
    which is especially nice when used with pretty_assertions crate
    Mingun committed May 8, 2022
    Copy the full SHA
    317ab14 View commit details
    Browse the repository at this point in the history
  7. Properly test all paths of attribute parsing

    failures (24):
        events::attributes::html::duplicated::with_check::double_quoted
        events::attributes::html::duplicated::with_check::key_only
        events::attributes::html::duplicated::with_check::single_quoted
        events::attributes::html::duplicated::with_check::unquoted
        events::attributes::html::single::missed_value
        events::attributes::html::sparsed::double_quoted
        events::attributes::html::sparsed::key_contains_invalid
        events::attributes::html::sparsed::key_only
        events::attributes::html::sparsed::key_start_invalid
        events::attributes::html::sparsed::missed_value
        events::attributes::html::sparsed::single_quoted
        events::attributes::html::sparsed::unquoted
        events::attributes::xml::duplicated::with_check::double_quoted
        events::attributes::xml::duplicated::with_check::key_only
        events::attributes::xml::duplicated::with_check::single_quoted
        events::attributes::xml::duplicated::with_check::unquoted
        events::attributes::xml::duplicated::without_check::key_only
        events::attributes::xml::duplicated::without_check::unquoted
        events::attributes::xml::first::key_only
        events::attributes::xml::first::missed_value
        events::attributes::xml::first::unquoted
        events::attributes::xml::single::key_only
        events::attributes::xml::single::missed_value
        events::attributes::xml::sparsed::missed_value
    Mingun committed May 8, 2022
    Copy the full SHA
    d516e45 View commit details
    Browse the repository at this point in the history
  8. Reimplement attributes parsing logic and fix all errors

    Introduce new `Attr` type that stores not only an attribute content, but also its shape
    Mingun committed May 8, 2022
    Copy the full SHA
    c81d25c View commit details
    Browse the repository at this point in the history