Skip to content

Implement InList and NotInList methods #250

@gavv

Description

@gavv

Some matcher structs (Number, DateTime) have InRange method that checks that the value belongs to given range [min; max].

Another convenient thing would be InList method, that checks that the value equals to one of the given values a, b, c, ....

For example:

array.Element(1).String().InList("green", "red")

We need to add InList and counterpart NotInList methods to the following structs:

  • Value
  • Object
  • Array
  • String
  • Number
  • Boolean (just for completeness)
  • Duration
  • DateTime

The new methods can use assertions of type AssertBelongs and AssertNotBelongs. Please place these methods after InRange, or after Equal* if there is no InRange for this struct.

Each method should have documentation comment with code example and be covered by a unit test. It would be also nice to demonstrate usage of InRange and InList in _examples/fruits_test.go.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions