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

assert: fix error message formatting for NotContains #1362

Merged
merged 2 commits into from
May 5, 2023

Commits on Mar 15, 2023

  1. assert: rename and refactor TestContainsFailMessage

    I've renamed it to TestContainsNotContains and added a test case
    structure so that I can use this test to validate the failure messages
    from both Contains and NotContains,
    
    There are no functional changes here, strictly refactoring. A new test
    case will be added in a subsequent change.
    wade-arista committed Mar 15, 2023
    Configuration menu
    Copy the full SHA
    6711924 View commit details
    Browse the repository at this point in the history
  2. assert: fix error message formatting for NotContains

    It was using "%s" to format the s and contains arguments, but these
    could be any type that supports iteration such as a map. In this case
    of NotContains failing against a map, it would print something like:
    
       "map[one:%!s(int=1)]" should not contain "one"
    
    Fix this using "%#v" as was already done for Contains and added test
    cases covering both the "len()" / iterable failure messages as well as
    the Contains/NotContains failure case.
    
    The new message for this example map would be something like:
    
        map[string]int{"one":1} should not contain "one"
    wade-arista committed Mar 15, 2023
    Configuration menu
    Copy the full SHA
    0c8fb8d View commit details
    Browse the repository at this point in the history