google / google/assertor

Better diff representation using bold / color

Open
#29 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
151
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Adding the semantics of swap, insertion or deletion.

This feature should be able to be turned on/off by [feature](https://doc.rust-lang.org/cargo/reference/features.html).

**Example 1:**

```
assert_that!(vec![1,4,3,2]).contains_exactly_in_order(vec![1,2,3,4]);
```

Idea of better message:

```
contents match, but order was wrong
---
expected: [1, 2, 3, 4]
actual : [1, 4, 3, 2]
```

**Example 2:**
```
assert_that!(vec![1, 3, 4, 5]).contains_exactly_in_order(vec![1,2,3,4]);
```

Idea of better message:
```
contents match, but order was wrong
---
expected: [1, 2, 3, 4]
actual : [1, 3, 4, 5]
```

**Color usage guideline:** Green should emphasize the normal case, and red should emphasize the unexpected case, imo.

**Estimation/design:** This needs quite big structural change in `Fact` struct. Specifically, more semantic structs may need to be defined to represent `added` or `deleted` object, because generating `Fact` should be decoupled from `formatting` in order to change the formatting logic in runtime.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.