-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: new string matcher * feature: migrate tool * fix: remove dependency to slices package
- Loading branch information
Showing
8 changed files
with
1,490 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# expect-migrate | ||
|
||
`expect-migrate` is a small command line tool to upgrade your go test source files | ||
using `github.com/halimath/[email protected]` to `github.com/halimath/expect@latest`. The tool rewrites | ||
go source files that in a lot of cases directly compile and run. In some cases minor work by the developer | ||
is needed. | ||
|
||
# Installation | ||
|
||
```shell | ||
go install github.com/halimath/expect/cmd/expect-migrate@main | ||
``` | ||
|
||
# Usage | ||
|
||
Given an input file `some_test.go` | ||
|
||
```go | ||
package some | ||
|
||
import ( | ||
"testing" | ||
. "github.com/halimath/expect-go" | ||
) | ||
|
||
func TestSomething(t *testing.T) { | ||
var err error | ||
s := produceValue() | ||
|
||
EnsureThat(t, err).Is(NoError()) | ||
ExpectThat(t, s).Is(Equal("foo")) | ||
} | ||
``` | ||
|
||
applying | ||
|
||
```shell | ||
expect-migrate some_test.go | ||
``` | ||
|
||
will rewrite the file to | ||
|
||
```go | ||
package some | ||
|
||
import ( | ||
"testing" | ||
"github.com/halimath/expect" | ||
"github.com/halimath/expect/is" | ||
) | ||
|
||
func TestSomething(t *testing.T) { | ||
var err error | ||
s := produceValue() | ||
expect.That(t, expect.FailNow(is.NoError(err))) | ||
expect.That(t, is.EqualTo(s, "foo")) | ||
} | ||
``` |
Oops, something went wrong.