Slide 32
Slide 32 text
function macro(t, input, expected) {
t.true(eval(input) === expected)
}
macro.title = (_, input, expected) => {
return `${input} === ${expected}`
}
test(macro, '2 + 2', 4)
test(macro, '2 * 3', 6)
macro.title = (_, input, expected) => {
return `${input} === ${expected}`
}
test(macro, '2 + 2', 4)
test(macro, '2 * 3', 6)
Macros can even generate test titles.
We encourage you to use macros, rather than generating tests. For instance it’s easier to statically analyse macros.