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

fix: make the format test print a diff of what's gone wrong #977

Merged
merged 1 commit into from
Mar 21, 2022
Merged

fix: make the format test print a diff of what's gone wrong #977

merged 1 commit into from
Mar 21, 2022

Conversation

huitseeker
Copy link
Contributor

When the format test fails, the output now looks better (it even has color):

huitseeker@Garillots-MBP.tmp/fastnft/sui_core(better_format_ cargo test -- format                                                                   [9:57:40]
   Compiling sui_core v0.1.0 (/Users/huitseeker/tmp/fastnft/sui_core)
    Finished test [unoptimized + debuginfo] target(s) in 5.01s
     Running unittests (/Users/huitseeker/tmp/fastnft/target/debug/deps/sui_core-bf6615b943a3725a)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 64 filtered out; finished in 0.00s

     Running tests/format.rs (/Users/huitseeker/tmp/fastnft/target/debug/deps/format-5ad2723ef95f03e7)

running 1 test
   Compiling sui_core v0.1.0 (/Users/huitseeker/tmp/fastnft/sui_core)
    Finished dev [unoptimized + debuginfo] target(s) in 3.43s
     Running `target/debug/examples/generate-format test`
thread 'main' panicked at 'assertion failed: `(left == right)`

Diff < left / right > :
 ---
 AccountAddress:
   NEWTYPESTRUCT:
     TUPLEARRAY:
       CONTENT: U8
       SIZE: 20
 AccountInfoRequest:
   STRUCT:
     - account:
         TYPENAME: SuiAddress
 AccountInfoResponse:
   STRUCT:
     - object_ids:
         SEQ:
           TUPLE:
<            - TYPENAME: SuiAddress
>            - TYPENAME: ObjectID
             - TYPENAME: SequenceNumber
             - TYPENAME: ObjectDigest

When the format test fails, the output now looks better

```
huitseeker@Garillots-MBP.tmp/fastnft/sui_core(better_format_ cargo test -- format                                                                   [9:57:40]
   Compiling sui_core v0.1.0 (/Users/huitseeker/tmp/fastnft/sui_core)
    Finished test [unoptimized + debuginfo] target(s) in 5.01s
     Running unittests (/Users/huitseeker/tmp/fastnft/target/debug/deps/sui_core-bf6615b943a3725a)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 64 filtered out; finished in 0.00s

     Running tests/format.rs (/Users/huitseeker/tmp/fastnft/target/debug/deps/format-5ad2723ef95f03e7)

running 1 test
   Compiling sui_core v0.1.0 (/Users/huitseeker/tmp/fastnft/sui_core)
    Finished dev [unoptimized + debuginfo] target(s) in 3.43s
     Running `target/debug/examples/generate-format test`
thread 'main' panicked at 'assertion failed: `(left == right)`

Diff < left / right > :
 ---
 AccountAddress:
   NEWTYPESTRUCT:
     TUPLEARRAY:
       CONTENT: U8
       SIZE: 20
 AccountInfoRequest:
   STRUCT:
     - account:
         TYPENAME: SuiAddress
 AccountInfoResponse:
   STRUCT:
     - object_ids:
         SEQ:
           TUPLE:
<            - TYPENAME: SuiAddress
>            - TYPENAME: ObjectID
             - TYPENAME: SequenceNumber
             - TYPENAME: ObjectDigest
```
Copy link
Contributor

@asonnino asonnino left a comment

Choose a reason for hiding this comment

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

<3

@huitseeker huitseeker merged commit aaa9978 into MystenLabs:main Mar 21, 2022
mwtian pushed a commit to mwtian/sui that referenced this pull request Sep 29, 2022
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.34 to 1.0.35.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](dtolnay/thiserror@1.0.34...1.0.35)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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