Closed luser closed 4 years ago
Hi!
Thanks for your interest. The main branch is supposed to support the "host" target (native compilation and tests ran locally, very close to what cargo would do).
As far as I can tell, so far, we have handled this on our projects with something like that as a helper in the integration tests:
#[cfg(test)]
fn test_resources() -> std::path::PathBuf {
dinghy_test::try_test_file_path("resources").unwrap_or("../resources".into())
}
But I agree we may be able to do something a bit better by integrating the helper. I think the rationale against it was to keep dinghy-test as small as possible (without the yaml parser for instance)...
That's a totally reasonable position, it'd be great to have an example like the above in the docs. Thanks!
good idea. done.
Thanks, that's really helpful!
I tried out dinghy at work where we have some cross-platform Rust code but aren't currently running our Rust tests on any mobile platforms. I got things to work without a lot of trouble (very cool!) but one of our tests had additional data files so I followed the sending more files directions and using
dinghy_test::test_file_path
worked fine running the tests on Android. However, when I tried to run the tests natively on my mac usingcargo test
it would fail withCouldn't find test data ...
. I looked briefly at thedinghy-test
source and while there seems to be a branch for non-mobile platforms I'm guessing this isn't exactly supported. I wound up just usingcfg
to use the existing hardcoded paths to the test files on non-mobile which isn't great but works.It'd be nice if
dinghy_test
worked for native desktop tests as well or if at least the documentation reflected the fact that you shouldn't use it for non-mobile testing.