Skip to content

expect_equal() and bang-bang #929

@krlmlr

Description

@krlmlr

expands the vectors during reporting. Tested with 1d04028.

library(testthat)

expect_equal(letters[1:2], LETTERS[1:2])
#> Error: letters[1:2] not equal to LETTERS[1:2].
#> 2/2 mismatches
#> x[1]: "a"
#> y[1]: "A"
#> 
#> x[2]: "b"
#> y[2]: "B"
expect_equal(letters[1:2], !!LETTERS[1:2])
#> Error: letters[1:2] not equal to "A".
#> 2/2 mismatches
#> x[1]: "a"
#> y[1]: "A"
#> 
#> x[2]: "b"
#> y[2]: "B"
#> letters[1:2] not equal to "B".
#> 2/2 mismatches
#> x[1]: "a"
#> y[1]: "A"
#> 
#> x[2]: "b"
#> y[2]: "B"
expect_equal(!!letters[1:2], LETTERS[1:2])
#> Error: "a" not equal to LETTERS[1:2].
#> 2/2 mismatches
#> x[1]: "a"
#> y[1]: "A"
#> 
#> x[2]: "b"
#> y[2]: "B"
#> "b" not equal to LETTERS[1:2].
#> 2/2 mismatches
#> x[1]: "a"
#> y[1]: "A"
#> 
#> x[2]: "b"
#> y[2]: "B"
expect_equal(!!letters[1:2], !!LETTERS[1:2])
#> Error: "a" not equal to "A".
#> 2/2 mismatches
#> x[1]: "a"
#> y[1]: "A"
#> 
#> x[2]: "b"
#> y[2]: "B"
#> "b" not equal to "B".
#> 2/2 mismatches
#> x[1]: "a"
#> y[1]: "A"
#> 
#> x[2]: "b"
#> y[2]: "B"

Created on 2019-08-27 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions