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

Conversation

Mingun
Copy link
Collaborator

@Mingun Mingun commented Jun 18, 2024

This PR removes duplicated tests, merge and split test files by purpose and removes unsignificant details (which is tested in other tests).

Also it adds explicit tests (as doctests) for Deref implementation of events and document it.

Mingun added 16 commits June 19, 2024 16:35
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
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
`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
In case of errors diff will readable
This option already tested in tests/reader-config.rs, therefore,
we will not overcomplicate the tests where it is not needed
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
…ror from test function

I'm afraid that if to return error then it will be not clear where it is originated
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
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
Renamed tests:
- test_sample       -> it_works
- test_clone_reader -> clone_state
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
…ormal test in reader-namespaces.rs

(Review in whitespace changes ignored mode)
(Review in whitespace changes ignored mode)
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
…ests/encodings.rs

Also add more checks to test for buffered reader related to BOM
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
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.
Both of removed tests testing the same thing: reading document with namespaces.
NsReader already tested in tests/reader-namespaces.rs more formally
The same things already tested more formally in tests/reader.rs and tests/reader-attributes.rs
@Mingun Mingun merged commit a85cab7 into tafia:master Jun 21, 2024
6 checks passed
@Mingun Mingun deleted the organize-tests branch June 21, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant