However, I have a use case where I need to access the data of the snapshot from expect to do further assertions.
It is not possible to workaround this by storing the data in a separate variable:
let data = "...";
let expect = expect![[data]];
just because expect! macro accepts a literal token, not an expr.
I suggest exposing a public getter for data, @matklad wdyt?
As for now the
data: &'static str
property ofExpect
struct is marked asdoc(hidden)
, which means that it is intended to be private.https://github.com/rust-analyzer/expect-test/blob/f0cd358a1c4bc876bb778d7b769e455052f6171f/src/lib.rs#L198-L205
However, I have a use case where I need to access the data of the snapshot from
expect
to do further assertions. It is not possible to workaround this by storing the data in a separate variable:just because
expect!
macro accepts aliteral
token, not anexpr
.I suggest exposing a public getter for
data
, @matklad wdyt?