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

refactor(snapbox): Changes to normalization #122

Merged
merged 4 commits into from
Aug 17, 2022

Conversation

Muscraft
Copy link
Collaborator

@Muscraft Muscraft commented Aug 15, 2022

This is a part of #92.

This PR is to help move forward the effort with supporting structured data formats. Part of this effort showed that there needed to be a better way to specify what normalization operation was wanted and later to unify what the operations are doing.

  • Abstract lower level map_text calls as normalize with operation types
    • By providing build blocks before, we were hoping to allow people to plug in their own normalization routines. However, when we add structured data support, it will need to operate on internal data initially as we work out details, so we're making all of the normalization logic private, just allowing the caller to which built-in normalization can be done.
  • change as_str to try_string and update its return to be Option<String>
    • The original intent of as_str was for outputting Diffs. This had to be changed to String since there are some formats that have borrowing issues with &str. By changing to String it allows support for more formats

crates/snapbox/src/data.rs Outdated Show resolved Hide resolved
crates/snapbox/src/data.rs Outdated Show resolved Hide resolved
crates/snapbox/src/assert.rs Outdated Show resolved Hide resolved
src/schema.rs Outdated Show resolved Hide resolved
@Muscraft Muscraft force-pushed the data-format-support branch 3 times, most recently from 849cff3 to 01338ca Compare August 16, 2022 21:14
crates/snapbox/src/assert.rs Outdated Show resolved Hide resolved
src/schema.rs Outdated Show resolved Hide resolved
crates/snapbox/src/data.rs Show resolved Hide resolved
crates/snapbox/src/lib.rs Show resolved Hide resolved
crates/snapbox/src/data.rs Outdated Show resolved Hide resolved
src/schema.rs Outdated Show resolved Hide resolved
crates/snapbox/src/path.rs Show resolved Hide resolved
crates/snapbox/src/assert.rs Outdated Show resolved Hide resolved
crates/snapbox/src/assert.rs Outdated Show resolved Hide resolved
crates/snapbox/src/assert.rs Outdated Show resolved Hide resolved
@epage epage merged commit 9494040 into assert-rs:main Aug 17, 2022
@Muscraft Muscraft deleted the data-format-support branch August 17, 2022 18: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.

None yet

2 participants