Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize tests #762

Merged
merged 26 commits into from
Jun 21, 2024
Merged

Organize tests #762

merged 26 commits into from
Jun 21, 2024

Commits on Jun 19, 2024

  1. Configuration menu
    Copy the full SHA
    4f0ffac View commit details
    Browse the repository at this point in the history
  2. Move definition of BytesDecl after BytesPI

    It was between BytesStart and BytesEnd which logically is not correct.
    It is logically based on BytesPI, because this is just a special processing instruction,
    for the XML processor itself
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    624891d View commit details
    Browse the repository at this point in the history
  3. Move all writer-only tests from tests/unit_tests.rs to tests/writer.rs

    Moved tests:
    - test_new_xml_decl_full       -> declaration::full
    - test_new_xml_decl_standalone -> declaration::standalone
    - test_new_xml_decl_encoding   -> declaration::encoding
    - test_new_xml_decl_version    -> declaration::version
    - test_new_xml_decl_empty      -> declaration::empty
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    0059377 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1ebc396 View commit details
    Browse the repository at this point in the history
  5. Remove duplicated roundtrip test

    `test_read_write_roundtrip_results_in_identity` the same as `test_read_write_roundtrip`
    except that it does not contain escaped data in the text
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    1b6a0e6 View commit details
    Browse the repository at this point in the history
  6. Check documents after roundtrip as strings

    In case of errors diff will readable
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    37852e0 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    866e1cd View commit details
    Browse the repository at this point in the history
  8. Remove unnecessary set of trim_text option

    This option already tested in tests/reader-config.rs, therefore,
    we will not overcomplicate the tests where it is not needed
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    837b9e2 View commit details
    Browse the repository at this point in the history
  9. Move all roundtrip tests from tests/unit_tests.rs to tests/roundtrip.rs

    Moved tests:
    - test_writer                                   -> with_trim
    - test_writer_borrow                            -> with_trim_ref
    - test_writer_indent                            -> with_indent
    - test_writer_indent_cdata                      -> with_indent_cdata
    - test_write_empty_element_attrs                -> events::empty
    - test_write_attrs                              -> partial_rewrite
    - test_read_write_roundtrip                     -> simple
    - test_read_write_roundtrip_escape_text         -> reescape_text
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    c05ea3c View commit details
    Browse the repository at this point in the history
  10. Use traditional tests with explicit .unwrap() instead of returning er…

    …ror from test function
    
    I'm afraid that if to return error then it will be not clear where it is originated
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    a48c88f View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    92574dd View commit details
    Browse the repository at this point in the history
  12. Use direct comparison of events instead of using macro

    Although this changes some checks for Text, CData, and Comment events - previously
    they checked `Deref` implementation of corresponding events, but this can be considered,
    as not planned side effect. Explicit testing of this implementation was added in one of
    previous commits
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    c3272e6 View commit details
    Browse the repository at this point in the history
  13. Move all attribute reading tests to tests/reader-attributes.rs

    Renamed tests:
    - test_closing_bracket_in_single_quote_attr  -> single_gt
    - test_closing_bracket_in_double_quote_attr  -> double_gt
    - test_closing_bracket_in_double_quote_mixed -> double_gt_apos
    - test_closing_bracket_in_single_quote_mixed -> single_gt_quot
    - test_attributes_empty                      -> empty_tag
    - test_attribute_equal                       -> equal_sign_in_value
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    db582ce View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    361a78c View commit details
    Browse the repository at this point in the history
  15. Merge tests/test.rs into tests/reader.rs

    Renamed tests:
    - test_sample       -> it_works
    - test_clone_reader -> clone_state
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    a5331bd View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    a7ee294 View commit details
    Browse the repository at this point in the history
  17. Remove excess tests from xmlrs_reader_tests.rs

    The following tests in `xmlrs_reader_tests.rs` already checked by the following existing tests:
    
    tabs_1
      file: tests/reader-config.rs
      test: all in `trim_text*` modules
    
    issue_83_duplicate_attributes
      file: src/events/attributes.rs
      test: all in `duplicated` modules
    
    issue_93_large_characters_in_entity_references
      This test actually not valid for quick-xml, because this is well-formedless test of
      acceptable characters in entity names, but quick-xml does not yet performs such checks
    
    issue_98_cdata_ending_with_right_bracket
      file: src/de/mod.rs
      test: many `cdata` tests in `merge_text` module
    
    issue_attributes_have_no_default_namespace
      file: tests/reader-namespaces.rs
      test: default_ns_shadowing_empty
    
    default_namespace_applies_to_end_elem
      file: tests/reader-namespaces.rs
      test: default_namespace
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    6ce0944 View commit details
    Browse the repository at this point in the history
  18. Replace test issue_default_namespace_on_outermost_element with more f…

    …ormal test in reader-namespaces.rs
    
    (Review in whitespace changes ignored mode)
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    fa5d052 View commit details
    Browse the repository at this point in the history
  19. Move default_ns_* tests into the module default_namespace

    (Review in whitespace changes ignored mode)
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    f567a74 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    eff9a86 View commit details
    Browse the repository at this point in the history
  21. More strict encoding tests - check that we get expected events

    As a result, `encoded_characters` test in xmlrs_reader_tests.rs can be removed,
    because we have a test that checks all characters of Shift_JIS encoding
    Mingun committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    e1e3489 View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2024

  1. Replace test bom_removed_from_initial_text with more formal test in t…

    …ests/encodings.rs
    
    Also add more checks to test for buffered reader related to BOM
    Mingun committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    625c74e View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2024

  1. Replace test escaped_characters with escape::test_escape

    The test in xmlrs_reader_tests.rs actually calls `unescape` function to get resulting
    strings that is matched in the test, so we just test that function instead
    Mingun committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    e9cab59 View commit details
    Browse the repository at this point in the history
  2. Remove not working and commented tests

    sample_3 and sample_4 tests was commented because they are ported from xml-rs crate
    and uses some reader settings which quick-xml does not have. No sense to keep them.
    
    sample_5 was ignored because parsing of UTF-16 coded documents not yet implemented.
    When such support will be added it will have its own test, no need to keep this one.
    Mingun committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    3321944 View commit details
    Browse the repository at this point in the history
  3. Remove namespaced reader tests from xmlrs_reader_tests.rs

    Both of removed tests testing the same thing: reading document with namespaces.
    NsReader already tested in tests/reader-namespaces.rs more formally
    Mingun committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    7463d2a View commit details
    Browse the repository at this point in the history
  4. Remove non-namespaced reader tests from xmlrs_reader_tests.rs

    The same things already tested more formally in tests/reader.rs and tests/reader-attributes.rs
    Mingun committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    486e64e View commit details
    Browse the repository at this point in the history