Expectation predicate for testing that a vector is fully contained within another vector

expect_in(current, target, ..., info = NA_character_)

Arguments

current

[R vector] A vector to be tested

target

[R vector] A vector to be compared against

...

Ignored

info

[character(1L)] Optional user-defined message; must be a single string value

Value

A tinytest object. A tinytest object is a logical with attributes holding information about the test that was run

See also

testthat equivalent: testthat::expect_in()

Other in-condition expectation predicates: expect_contains(), expect_mapequal(), expect_setequal()

Examples

expect_in(letters, target = rev(letters)) # Pass
#> ----- PASSED      : <-->
#>  call| expect_in(letters, target = rev(letters)) 
expect_in(letters, target = "b") # Fail
#> ----- FAILED[xcpt]: <-->
#>  call| expect_in(letters, target = "b")
#>  diff| Expected all values of 'current' to be in 'target' 
expect_in("b", target = letters) # Pass
#> ----- PASSED      : <-->
#>  call| expect_in("b", target = letters)