x <- c(
"#0123456", "#789abc", "#defDEF", #ok
"012345", #no hash
"#g12345", #bad letter
"#01 23 45", #contains spaces
"#12345", "#1234567" #wrong length
)
is_hex_colour(x)
assert_any_are_hex_colours(x)
#These examples should fail.
assert_all_are_hex_colours(x)
Run the code above in your browser using DataLab