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

Adds integration testing for Ion 1.1 #673

Merged
merged 3 commits into from
Oct 19, 2023
Merged

Conversation

popematt
Copy link
Contributor

Issue #, if available:

None

Description of changes:

  • There are a few clippy changes because a new version of rust was released.
  • A large portion of the diff is iontestdata -> iontestdata_1_0.
  • Adds an ion_1_1 module to element_test_vectors.rs integration testing for the Ion 1.1 reader.
  • Adds support for reading equivs and non-equivs test cases that are defined as a struct, and for reading embedded documents that are a blob.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@popematt popematt requested a review from zslayton October 17, 2023 20:12
@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

All modified lines are covered by tests ✅

Files Coverage Δ
src/ion_data/mod.rs 78.78% <100.00%> (ø)
src/types/struct.rs 89.13% <100.00%> (ø)

... and 3 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

Copy link
Contributor

@zslayton zslayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

There are a few unrelated clippy warnings on the diff.

tests/element_test_vectors.rs Outdated Show resolved Hide resolved
tests/element_test_vectors.rs Outdated Show resolved Hide resolved
Comment on lines +152 to +156
fn read_embedded_doc_as_sequence(elem: &Element) -> IonResult<Sequence> {
match elem.value() {
Value::String(text) => Element::read_all(text.text().as_bytes()),
Value::Blob(bytes) => Element::read_all(bytes.as_ref()),
_ => panic!("Expected embedded document to be an Ion String or Ion Blob"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Self::read_group_embedded(&sequence, &group_assert)?;
}
(Value::List(group), false) | (Value::SExp(group), false) => {
match group_container.value().to_owned() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the to_owned() needed? It looks like we're just iterating over whatever we get.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A to_owned() is necessary somewhere because I can't have the if expression returning Sequence from one branch and &Sequence from another, but I was able to move the to_owned() call so that it is used as late as possible.

@popematt popematt merged commit fa3167d into amazon-ion:main Oct 19, 2023
18 checks passed
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.

2 participants