File tree Expand file tree Collapse file tree
crates/libtest2/tests/testsuite Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ fn test_cmd ( ) -> snapbox:: cmd:: Command {
2+ static BIN : once_cell_polyfill:: sync:: OnceLock < ( std:: path:: PathBuf , std:: path:: PathBuf ) > =
3+ once_cell_polyfill:: sync:: OnceLock :: new ( ) ;
4+
5+ let ( bin, current_dir) = BIN . get_or_init ( || {
6+ let package_root = crate :: util:: new_test (
7+ r#"
8+ #[libtest2::main]
9+ fn main() {}
10+
11+ #[libtest2::test]
12+ fn checks_the_name_of_itself(context: &libtest2::TestContext) {
13+ assert_eq!(context.test_name(), "checks_the_name_of_itself");
14+ }
15+
16+ mod some_module {
17+ #[libtest2::test]
18+ fn checks_the_name_of_itself(context: &libtest2::TestContext) {
19+ assert_eq!(context.test_name(), "some_module::checks_the_name_of_itself");
20+ }
21+ }
22+ "# ,
23+ false ,
24+ ) ;
25+ let bin = crate :: util:: compile_test ( & package_root) ;
26+ ( bin, package_root)
27+ } ) ;
28+ snapbox:: cmd:: Command :: new ( bin) . current_dir ( current_dir)
29+ }
30+
31+ #[ test]
32+ fn all_pass ( ) {
33+ test_cmd ( ) . assert ( ) . code ( 0 ) ;
34+ }
Original file line number Diff line number Diff line change 11mod all_passing;
22mod argfile;
3+ mod macros;
34mod mixed_bag;
45mod panic;
56mod should_panic;
You can’t perform that action at this time.
0 commit comments