Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wishlist: port all tests to quicktest #219

Closed
warpfork opened this issue Aug 4, 2021 · 1 comment · Fixed by #299
Closed

wishlist: port all tests to quicktest #219

warpfork opened this issue Aug 4, 2021 · 1 comment · Fixed by #299
Assignees
Labels
effort/days Estimated to take multiple days, but less than a week exp/beginner Can be confidently tackled by newcomers kind/test Testing work P3 Low: Not priority right now

Comments

@warpfork
Copy link
Collaborator

warpfork commented Aug 4, 2021

https://pkg.go.dev/github.com/frankban/quicktest is now clearly superior to https://pkg.go.dev/github.com/warpfork/go-wish .

We've started using quicktest in some parts of this repo already and it's working great.

It would be nice to port all the tests to using quicktest and see one more dependency drop from the go.mod file.

This should be relatively easy. The style used by quicktest and wish are syntactically and semantically extremely similar.

@warpfork warpfork added P3 Low: Not priority right now kind/test Testing work exp/beginner Can be confidently tackled by newcomers effort/days Estimated to take multiple days, but less than a week labels Aug 4, 2021
@mvdan
Copy link
Contributor

mvdan commented Aug 7, 2021

I'd usually recommend to do a slow transition as the codebase is modified, to avoid too much churn and conflicts.

But in this case, given that go-wish and quicktest are pretty similar, it probably doesn't make sense to leave the repository using both for months or years. So maybe it is worth the effort to try to automate the refactor.

Maybe it could be done in groups of packages, to make the reviews less painful.

masih added a commit that referenced this issue Nov 9, 2021
Port the tests in `node` pacakge to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`

Port `closeEnough` Wish checker to its equivelant in quicktest.

Relates to:
 - #219
masih added a commit that referenced this issue Nov 9, 2021
Port the tests in `node` pacakge to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`

Port `closeEnough` Wish checker to its equivelant in quicktest.

Relates to:
 - #219
@masih masih self-assigned this Nov 9, 2021
masih added a commit that referenced this issue Nov 9, 2021
Port the tests in `node` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 9, 2021
Port the tests in `node` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsNil` for `nil` with `ShouldEqual`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 9, 2021
Port the tests in `adl` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsNil` for `nil` with `ShouldEqual`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `node` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for ShouldEqual` over `true`
 - `qt.IsFalse` for ShouldEqual` over `false`
 - `qt.IsNil` for ShouldEqual` over `nil`
 - `qt.ErrorMatches` for ShouldEqual` over `err.Error()`

Port `closeEnough` Wish checker to its equivelant in quicktest.

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `node` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for ShouldEqual` over `true`
 - `qt.IsFalse` for ShouldEqual` over `false`
 - `qt.IsNil` for ShouldEqual` over `nil`

Port `closeEnough` Wish checker to its equivalent in quicktest.

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `node` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for ShouldEqual` over `true`
 - `qt.IsFalse` for ShouldEqual` over `false`
 - `qt.IsNil` for ShouldEqual` over `nil`

Port `closeEnough` Wish checker to its equivalent in quicktest.

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `adl` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsNil` for `nil` with `ShouldEqual`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Implement `NodeContentEquals` quicktest checker that checks two given
nodes have equal content by comparing their printout using `printer`.
This simplifies the tests that use `datamode.DeepEqual` by performing
an equivalent check while producing a human-readable error when nodes
are not equal. The naming for this check is inspired by a similar
equality check in quicktest, named `ContentEquals`.

Port the tests in `codec` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `NodeContentEquals` for `ShouldEqual` over nodes

Address TODO in node tests by using `NodeContentEquals` to check node
equality.

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Implement `NodeContentEquals` quicktest checker that checks two given
nodes have equal content by comparing their printout using
`dagjson.Encode`. This simplifies the tests that use
`datamode.DeepEqual` by performing an equivalent check while producing a
human-readable error when nodes are not equal. The naming for this check
is inspired by a similar equality check in quicktest, named
`ContentEquals`.

Port the tests in `codec` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `NodeContentEquals` for `ShouldEqual` over nodes

Address TODO in node tests by using `NodeContentEquals` to check node
equality.

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `datamodel` package to quicktest; use:
 - `qt.Check` for `wish.Wish`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `qt.CmpEquals` with custom `Exporter` that exports all fields for
   `ShouldEqual` over `PathSegment`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `datamodel` package to quicktest; use:
 - `qt.Check` for `wish.Wish`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `qt.CmpEquals` with custom `Exporter` that exports all fields for
   `ShouldEqual` over `PathSegment`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `fluent` package to quicktest; use:
 - `qt.Check` for `wish.Wish`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `qt.DeepEquals` for `ShouldEqual` over `[]byte` and `fluent.Error`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `datamodel` package to quicktest; use:
 - `qt.Check` for `wish.Wish`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `qt.CmpEquals` with custom `Exporter` that exports all fields for
   `ShouldEqual` over `PathSegment`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Port the tests in `fluent` package to quicktest; use:
 - `qt.Check` for `wish.Wish`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `qt.DeepEquals` for `ShouldEqual` over `[]byte` and `fluent.Error`

Relates to:
 - #219
masih added a commit that referenced this issue Nov 10, 2021
Implement `NodeContentEquals` quicktest checker that checks two given
nodes have equal content by comparing their printout using
`printer.Sprint`. This simplifies the tests that use
`datamode.DeepEqual` by performing an equivalent check while producing a
human-readable error when nodes are not equal. The naming for this check
is inspired by a similar equality check in quicktest, named
`ContentEquals`.

Port the tests in `codec` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for `ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `NodeContentEquals` for `ShouldEqual` over nodes
 - `NodeContentEquals` for `datamodel.DeepEqual` over nodes

Update `NodeContentEquals` for `datamodel.DeepEqual` over nodes in
`node` package while at it.

Port `node/mixins/TestSplitExact` over to quicktest missed out in
earlier PRs. Note, to assert equality `CmpEqual` is used with an
`Exporter` that exports all unexpored fields.

Address TODO in node tests by using `NodeContentEquals` to check node
equality.

Relates to:
 - #219

Depends on:
 - #294
masih added a commit that referenced this issue Nov 11, 2021
Implement `NodeContentEquals` quicktest checker that checks two given
nodes have equal content by comparing their printout using
`printer.Sprint`. This simplifies the tests that use
`datamode.DeepEqual` by performing an equivalent check while producing a
human-readable error when nodes are not equal. The naming for this check
is inspired by a similar equality check in quicktest, named
`ContentEquals`.

Port the tests in `codec` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for `ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `NodeContentEquals` for `ShouldEqual` over nodes
 - `NodeContentEquals` for `datamodel.DeepEqual` over nodes

Update `NodeContentEquals` for `datamodel.DeepEqual` over nodes in
`node` package while at it.

Port `node/mixins/TestSplitExact` over to quicktest missed out in
earlier PRs. Note, to assert equality `CmpEqual` is used with an
`Exporter` that exports all unexpored fields.

Address TODO in node tests by using `NodeContentEquals` to check node
equality.

Relates to:
 - #219

Depends on:
 - #294
masih added a commit that referenced this issue Nov 11, 2021
Implement `NodeContentEquals` quicktest checker that checks two given
nodes have equal content by comparing their printout using
`printer.Sprint`. This simplifies the tests that use
`datamode.DeepEqual` by performing an equivalent check while producing a
human-readable error when nodes are not equal. The naming for this check
is inspired by a similar equality check in quicktest, named
`ContentEquals`.

Port the tests in `codec` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for `ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `NodeContentEquals` for `ShouldEqual` over nodes
 - `NodeContentEquals` for `datamodel.DeepEqual` over nodes

Update `NodeContentEquals` for `datamodel.DeepEqual` over nodes in
`node` package while at it.

Port `node/mixins/TestSplitExact` over to quicktest missed out in
earlier PRs. Note, to assert equality `CmpEqual` is used with an
`Exporter` that exports all unexpored fields.

Address TODO in node tests by using `NodeContentEquals` to check node
equality.

Relates to:
 - #219

Depends on:
 - #294
masih added a commit that referenced this issue Nov 11, 2021
Implement `NodeContentEquals` quicktest checker that checks two given
nodes have equal content by comparing their printout using
`printer.Sprint`. This simplifies the tests that use
`datamode.DeepEqual` by performing an equivalent check while producing a
human-readable error when nodes are not equal. The naming for this check
is inspired by a similar equality check in quicktest, named
`ContentEquals`.

Port the tests in `codec` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for `ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `NodeContentEquals` for `ShouldEqual` over nodes
 - `NodeContentEquals` for `datamodel.DeepEqual` over nodes

Update `NodeContentEquals` for `datamodel.DeepEqual` over nodes in
`node` package while at it.

Port `node/mixins/TestSplitExact` over to quicktest missed out in
earlier PRs. Note, to assert equality `CmpEqual` is used with an
`Exporter` that exports all unexpored fields.

Address TODO in node tests by using `NodeContentEquals` to check node
equality.

Relates to:
 - #219

Depends on:
 - #294
masih added a commit that referenced this issue Nov 11, 2021
Implement `NodeContentEquals` quicktest checker that checks two given
nodes have equal content by comparing their printout using
`printer.Sprint`. This simplifies the tests that use
`datamode.DeepEqual` by performing an equivalent check while producing a
human-readable error when nodes are not equal. The naming for this check
is inspired by a similar equality check in quicktest, named
`ContentEquals`.

Port the tests in `codec` package to quicktest; use:
 - `qt.Assert` for `wish.Require`
 - `qt.Check` for `wish.Wish`
 - `qt.IsTrue` for `ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `NodeContentEquals` for `ShouldEqual` over nodes
 - `NodeContentEquals` for `datamodel.DeepEqual` over nodes

Update `NodeContentEquals` for `datamodel.DeepEqual` over nodes in
`node` package while at it.

Port `node/mixins/TestSplitExact` over to quicktest missed out in
earlier PRs. Note, to assert equality `CmpEqual` is used with an
`Exporter` that exports all unexpored fields.

Address TODO in node tests by using `NodeContentEquals` to check node
equality.

Relates to:
 - #219

Depends on:
 - #294
masih added a commit that referenced this issue Nov 11, 2021
Port the tests in `traversal` package to quicktest; use:
 - `qt.Check` for `wish.Wish`
 - `qt.Assert` for `wish.Require`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `qt.IsTrue` for `ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.DeepEquals` for `ShouldEqual` over slices
 - `CmpEquals` for `ShouldEqual` over types with unexported fields
    excluding `datamodel.Node` with custom exporter to allow checking
    of all unexported fields
      - Defined checker once and reused across packages. Did not add
        this to `node/tests` to avoid cycle package dependency.
 - `nodetests.NodeContentEquals` over `datamodel.DeepEqual` and
   `ShouldEqual` over `datamodel.Node`

Fixes #219
masih added a commit that referenced this issue Nov 11, 2021
Port the tests in `traversal` package to quicktest; use:
 - `qt.Check` for `wish.Wish`
 - `qt.Assert` for `wish.Require`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `qt.IsTrue` for `ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.HasLen` for `ShouldEqual` over slice length
 - `qt.DeepEquals` for `ShouldEqual` over slices
 - `CmpEquals` for `ShouldEqual` over types with unexported fields
    excluding `datamodel.Node` with custom exporter to allow checking
    of all unexported fields
      - Defined checker once and reused across packages. Did not add
        this to `node/tests` to avoid cycle package dependency.
 - `nodetests.NodeContentEquals` over `datamodel.DeepEqual` and
   `ShouldEqual` over `datamodel.Node`

Fixes #219
masih added a commit that referenced this issue Nov 11, 2021
Port the tests in `traversal` package to quicktest; use:
 - `qt.Check` for `wish.Wish`
 - `qt.Assert` for `wish.Require`
 - `qt.IsNil` for `ShouldEqual` over `nil`
 - `qt.IsTrue` for `ShouldEqual` over `true`
 - `qt.IsFalse` for `ShouldEqual` over `false`
 - `qt.HasLen` for `ShouldEqual` over slice length
 - `qt.DeepEquals` for `ShouldEqual` over slices
 - `CmpEquals` for `ShouldEqual` over types with unexported fields
    excluding `datamodel.Node` with custom exporter to allow checking
    of all unexported fields
      - Defined checker once and reused across packages. Did not add
        this to `node/tests` to avoid cycle package dependency.
 - `nodetests.NodeContentEquals` over `datamodel.DeepEqual` and
   `ShouldEqual` over `datamodel.Node`

Fixes #219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/days Estimated to take multiple days, but less than a week exp/beginner Can be confidently tackled by newcomers kind/test Testing work P3 Low: Not priority right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants