gotestyourself / gotestyourself/gotest.tools

Improved error message when checks with variables fail

Open
#92 4 comments 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
576
Forks
54
Avg merge
6d 3h
Merged PRs (30d)
2

Description

I realise this would be difficult (or potentially impossible) to solve, but when an expression fails it would be very useful to have the value available.

eg.

The following test code:

```go
a := 1
assert.Check(t, a == 2)
```

Produces the error:

```
parser_test.go:20: assertion failed: expression is false: a == 2
```

This is not that helpful, as I now need to edit the code to print the actual value.

Ideally it would print something like:

```
parser_test.go:20: assertion failed: expression is false: a (1) == 2
```

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.