-
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.
- Loading branch information
Showing
8 changed files
with
275 additions
and
31 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,10 @@ | ||
.PHONY: * | ||
|
||
test: | ||
go test -tags mock -race -cover ./... | ||
|
||
lint: | ||
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 run --color always ${args} | ||
|
||
lint-fix: | ||
make lint args=--fix |
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 |
---|---|---|
@@ -1,8 +1,17 @@ | ||
# deeply | ||
|
||
Stub filtering algorithms. | ||
`deeply` is a package that provides stub filtering algorithms, which is used in `bavix/gripmock`. | ||
|
||
--- | ||
Supported by | ||
Stub filtering algorithms is a technique used to filter stubs based on expectations. It is a powerful tool for testing and development. | ||
|
||
[![Supported by JetBrains](https://cdn.rawgit.com/bavix/development-through/46475b4b/jetbrains.svg)](https://www.jetbrains.com/) | ||
These algorithms are written in a form of a function that takes an expectation and an actual value and returns a boolean result. | ||
|
||
In a nutshell, `Matches` checks if the actual value matches the expectation, `Contains` checks if the actual value contains the expectation, `ContainsIgnoreArrayOrder` checks if the actual value contains the expectation ignoring the order of elements in arrays, and `MatchesIgnoreArrayOrder` checks if the actual value matches the expectation ignoring the order of elements in arrays. | ||
|
||
Furthermore, `deeply` provides methods `Equals` and `EqualsIgnoreArrayOrder` that checks if the expected and actual values are deeply equal. The `Equals` method checks if the expected and actual values are deeply equal and ignores the order of arrays, while the `EqualsIgnoreArrayOrder` method checks if the expected and actual values are deeply equal ignoring the order of arrays. | ||
|
||
Both `Equals` and `EqualsIgnoreArrayOrder` methods return true if any of the following conditions are met: | ||
|
||
- The expected and actual values are both maps and have the same number of keys. | ||
- The expected and actual values are both slices and have the same length. | ||
- The expected and actual values are deeply equal using reflect.DeepEqual. |
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
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
Oops, something went wrong.