Skip to content

Commit 57b49bc

Browse files
authored
Add release notes for v1.4.0, fix typos and missing docs (#29)
1 parent 8ff19c8 commit 57b49bc

File tree

10 files changed

+93
-34
lines changed

10 files changed

+93
-34
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ jobs:
3636
- name: Test and build
3737
run: rake build
3838

39-
# - name: Run tests with coverage
40-
# if: matrix.os != 'windows-latest'
41-
# run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
42-
43-
# - name: Run tests without coverage (windows)
44-
# if: matrix.os == 'windows-latest'
45-
# run: go test -race ./...
46-
4739
- name: Upload coverage
4840
if: matrix.os != 'windows-latest'
4941
uses: codecov/codecov-action@v4

.github/workflows/release.yaml

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,41 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-ruby@v1
13-
with:
14-
ruby-version: '2.5'
15-
- uses: actions/setup-go@v2
16-
with:
17-
go-version: 1.14
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
1813

19-
- name: Run tests
20-
if: matrix.os == 'windows-latest'
21-
run: go test -race ./...
14+
- name: Install Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version: 1.23.x
2218

23-
- name: Build and publish
24-
run: rake build
19+
- name: Check version
20+
run: go version
2521

26-
# - name: Archive action artifacts
27-
# uses: actions/upload-artifact@v2
28-
# with:
29-
# name: artifacts
30-
# path: build/artifacts/*
22+
- name: Test and build
23+
run: rake build
3124

32-
- name: Upload artifacts to release
33-
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
34-
uses: ncipollo/release-action@v1
35-
with:
36-
artifacts: "build/artifacts/*"
37-
bodyFile: "build/release_notes"
38-
token: ${{ secrets.GITHUB_TOKEN }}
25+
- name: Upload coverage
26+
uses: codecov/codecov-action@v4
27+
with:
28+
token: ${{ secrets.CODECOV_TOKEN }}
29+
verbose: true
30+
flags: unittests
31+
file: build/go-test-coverage.txt
32+
33+
- name: Archive build artifacts
34+
if: ${{ !cancelled() }}
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: ${{ github.event.repository.name }}-${{env.VERSION}}
38+
path: |
39+
build/release_notes.md
40+
build/artifacts/*
41+
42+
- name: Upload artifacts to release
43+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
44+
uses: ncipollo/release-action@v1
45+
with:
46+
artifacts: "build/artifacts/*"
47+
bodyFile: "build/release_notes"
48+
token: ${{ secrets.GITHUB_TOKEN }}

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"cSpell.words": [
33
"codecov",
44
"errorf",
5+
"keypath",
6+
"niladic",
57
"struct",
68
"subexpr",
79
"testpredicate"

RELEASES.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
# v1.4.0
2+
3+
## Improvements
4+
5+
- Add flexibility to `IsError()` to support:
6+
- `IsError("")` matching any error
7+
- `IsError(nil)` matching no error
8+
- `IsError(err)` matching with `errors.Is()`,
9+
- `IsError(<string>)` matching errors whose message contains the string
10+
- `IsError(<regexp>)` matching errors whose message match the regular expression
11+
- Relax `IsNotNil()` to accept values of non-nillable types as not nil.
12+
- Add `t.With()` as an option to further qualify the test conditions
13+
14+
15+
## Code changes
16+
17+
- Update CI, bump go min version to 1.19
18+
([#23](https://github.com/maargenton/go-testpredicate/pull/23))
19+
- Fix CI on Windows runners
20+
([#24](https://github.com/maargenton/go-testpredicate/pull/24))
21+
- Add support for `t.With(...)` in BDD-style test structure
22+
([#25](https://github.com/maargenton/go-testpredicate/pull/25))
23+
- Relax implementation of `.IsNotNil()` to return true for any value of a
24+
non-nillable type
25+
([#26](https://github.com/maargenton/go-testpredicate/pull/26))
26+
- Make `.IsError(...)` more flexible
27+
([#27](https://github.com/maargenton/go-testpredicate/pull/27))
28+
29+
## Related issues
30+
31+
- BDD style given-when-then could benefit from a "with" clause
32+
([#22](https://github.com/maargenton/go-testpredicate/issues/22))
33+
- `IsNotNil()` predicate is too strict
34+
([#20](https://github.com/maargenton/go-testpredicate/issues/20))
35+
- `.IsError(...)` predicate could be more flexible
36+
([#21](https://github.com/maargenton/go-testpredicate/issues/21))
37+
38+
139
# v1.3.0
240

341
## Improvements

pkg/utils/builder/builder.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Package builder is main underlying package in the implementation of
2+
// `verify.That()` and `require.That()`, with the `Builder` type providing the
3+
// core functionality of the predicate builder. It used go generate and a code
4+
// generator to forward individual predicates from `predicate/impl` onto the
5+
// `Builder` type.
16
package builder
27

38
//go:generate go run github.com/maargenton/go-testpredicate/pkg/utils/codegen/forward_api ../predicate/impl builder_api.tmpl

pkg/utils/builder/builder_api.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ func (b *Builder) Passes(p *predicate.Predicate) *predicate.Predicate {
183183
// From pkg/utils/predicate/impl/ext.go
184184
// ---------------------------------------------------------------------------
185185

186+
// ---------------------------------------------------------------------------
187+
// From pkg/utils/predicate/impl/impl.go
188+
189+
// From pkg/utils/predicate/impl/impl.go
190+
// ---------------------------------------------------------------------------
191+
186192
// ---------------------------------------------------------------------------
187193
// From pkg/utils/predicate/impl/map.go
188194

pkg/utils/predicate/impl/impl.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Package impl defines all the support predicates and transformation function
2+
// as individual functions that are then forwarded through code generation to
3+
// the Builder type.
4+
package impl

pkg/utils/predicate/predicate.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Package predicate defines both `Predicate“ and `Transform` types and handles
2+
// the predicate evaluation process.
13
package predicate
24

35
import "strings"

pkg/utils/value/field.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
// Field takes a root value or an array of root values, navigates through the
99
// data tree according to a keypath, and returns the targeted values. `keypath`
1010
// is a dot-separated list of keys, each used as either field name in a struct,
11-
// a key in a map, or a niladic method name. Any error during key evalation
11+
// a key in a map, or a niladic method name. Any error during key evaluation
1212
// results in a nil value. If a method invocation yields multiple return values,
1313
// only the first one is captured.
1414
//

pkg/verify/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
// Context captures an additional context value to be displayed upon failure.
1111
type Context = predicate.ContextValue
1212

13-
// That captrues the test context and a value for the purpose of building and
13+
// That captures the test context and a value for the purpose of building and
1414
// evaluating a test predicate through call chaining. The current test will
1515
// proceed even if the predicate fails.
1616
func That(t predicate.T, v interface{}, ctx ...Context) *builder.Builder {

0 commit comments

Comments
 (0)