Skip to content

Commit

Permalink
Add release notes for v1.4.0, fix typos and missing docs (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
maargenton authored Nov 11, 2024
1 parent 8ff19c8 commit 57b49bc
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 34 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ jobs:
- name: Test and build
run: rake build

# - name: Run tests with coverage
# if: matrix.os != 'windows-latest'
# run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...

# - name: Run tests without coverage (windows)
# if: matrix.os == 'windows-latest'
# run: go test -race ./...

- name: Upload coverage
if: matrix.os != 'windows-latest'
uses: codecov/codecov-action@v4
Expand Down
58 changes: 34 additions & 24 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,41 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.5'
- uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Checkout repository
uses: actions/checkout@v4

- name: Run tests
if: matrix.os == 'windows-latest'
run: go test -race ./...
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x

- name: Build and publish
run: rake build
- name: Check version
run: go version

# - name: Archive action artifacts
# uses: actions/upload-artifact@v2
# with:
# name: artifacts
# path: build/artifacts/*
- name: Test and build
run: rake build

- name: Upload artifacts to release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ncipollo/release-action@v1
with:
artifacts: "build/artifacts/*"
bodyFile: "build/release_notes"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
flags: unittests
file: build/go-test-coverage.txt

- name: Archive build artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{env.VERSION}}
path: |
build/release_notes.md
build/artifacts/*
- name: Upload artifacts to release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ncipollo/release-action@v1
with:
artifacts: "build/artifacts/*"
bodyFile: "build/release_notes"
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"cSpell.words": [
"codecov",
"errorf",
"keypath",
"niladic",
"struct",
"subexpr",
"testpredicate"
Expand Down
38 changes: 38 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# v1.4.0

## Improvements

- Add flexibility to `IsError()` to support:
- `IsError("")` matching any error
- `IsError(nil)` matching no error
- `IsError(err)` matching with `errors.Is()`,
- `IsError(<string>)` matching errors whose message contains the string
- `IsError(<regexp>)` matching errors whose message match the regular expression
- Relax `IsNotNil()` to accept values of non-nillable types as not nil.
- Add `t.With()` as an option to further qualify the test conditions


## Code changes

- Update CI, bump go min version to 1.19
([#23](https://github.com/maargenton/go-testpredicate/pull/23))
- Fix CI on Windows runners
([#24](https://github.com/maargenton/go-testpredicate/pull/24))
- Add support for `t.With(...)` in BDD-style test structure
([#25](https://github.com/maargenton/go-testpredicate/pull/25))
- Relax implementation of `.IsNotNil()` to return true for any value of a
non-nillable type
([#26](https://github.com/maargenton/go-testpredicate/pull/26))
- Make `.IsError(...)` more flexible
([#27](https://github.com/maargenton/go-testpredicate/pull/27))

## Related issues

- BDD style given-when-then could benefit from a "with" clause
([#22](https://github.com/maargenton/go-testpredicate/issues/22))
- `IsNotNil()` predicate is too strict
([#20](https://github.com/maargenton/go-testpredicate/issues/20))
- `.IsError(...)` predicate could be more flexible
([#21](https://github.com/maargenton/go-testpredicate/issues/21))


# v1.3.0

## Improvements
Expand Down
5 changes: 5 additions & 0 deletions pkg/utils/builder/builder.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Package builder is main underlying package in the implementation of
// `verify.That()` and `require.That()`, with the `Builder` type providing the
// core functionality of the predicate builder. It used go generate and a code
// generator to forward individual predicates from `predicate/impl` onto the
// `Builder` type.
package builder

//go:generate go run github.com/maargenton/go-testpredicate/pkg/utils/codegen/forward_api ../predicate/impl builder_api.tmpl
Expand Down
6 changes: 6 additions & 0 deletions pkg/utils/builder/builder_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ func (b *Builder) Passes(p *predicate.Predicate) *predicate.Predicate {
// From pkg/utils/predicate/impl/ext.go
// ---------------------------------------------------------------------------

// ---------------------------------------------------------------------------
// From pkg/utils/predicate/impl/impl.go

// From pkg/utils/predicate/impl/impl.go
// ---------------------------------------------------------------------------

// ---------------------------------------------------------------------------
// From pkg/utils/predicate/impl/map.go

Expand Down
4 changes: 4 additions & 0 deletions pkg/utils/predicate/impl/impl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Package impl defines all the support predicates and transformation function
// as individual functions that are then forwarded through code generation to
// the Builder type.
package impl
2 changes: 2 additions & 0 deletions pkg/utils/predicate/predicate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package predicate defines both `Predicate“ and `Transform` types and handles
// the predicate evaluation process.
package predicate

import "strings"
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/value/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
// Field takes a root value or an array of root values, navigates through the
// data tree according to a keypath, and returns the targeted values. `keypath`
// is a dot-separated list of keys, each used as either field name in a struct,
// a key in a map, or a niladic method name. Any error during key evalation
// a key in a map, or a niladic method name. Any error during key evaluation
// results in a nil value. If a method invocation yields multiple return values,
// only the first one is captured.
//
Expand Down
2 changes: 1 addition & 1 deletion pkg/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// Context captures an additional context value to be displayed upon failure.
type Context = predicate.ContextValue

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

0 comments on commit 57b49bc

Please sign in to comment.