Start invoking the tests.
This commit is contained in:
		
							parent
							
								
									8a26965e14
								
							
						
					
					
						commit
						8271f6b44a
					
				| @ -43,22 +43,32 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { | ||||
| 
 | ||||
| #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] | ||||
| async fn main_body() -> Result<(), Box<dyn std::error::Error>> { | ||||
|     let single_file = TestConfig::SingleFile(SingleFile { | ||||
|         name: "foo".to_owned(), | ||||
|         file_path: PathBuf::from("/tmp/test.org"), | ||||
|     let layer = compare_group("org-mode", || { | ||||
|         compare_all_org_document("/foreign_documents/org-mode") | ||||
|     }); | ||||
|     // let result = single_file.run_test().await;
 | ||||
|     let result = tokio::spawn(single_file.run_test()).await; | ||||
|     println!("{:?}", result); | ||||
|     // let test_config = TestConfig::TestLayer(TestLayer {
 | ||||
|     //     name: "foo",
 | ||||
|     //     children: vec![TestConfig::SingleFile(SingleFile {
 | ||||
|     //         file_path: Path::new("/tmp/test.org"),
 | ||||
|     //     })],
 | ||||
|     // });
 | ||||
|     let layer = layer.chain(compare_group("emacs", || { | ||||
|         compare_all_org_document("/foreign_documents/emacs") | ||||
|     })); | ||||
| 
 | ||||
|     let running_tests: Vec<_> = layer.map(|c| tokio::spawn(c.run_test())).collect(); | ||||
|     for test in running_tests.into_iter() { | ||||
|         let test_result = test.await??; | ||||
|         println!("{:?}", test_result); | ||||
|     } | ||||
| 
 | ||||
|     Ok(()) | ||||
| } | ||||
| 
 | ||||
| fn compare_group<N: Into<String>, F: Fn() -> I, I: Iterator<Item = TestConfig>>( | ||||
|     name: N, | ||||
|     inner: F, | ||||
| ) -> impl Iterator<Item = TestConfig> { | ||||
|     std::iter::once(TestConfig::TestLayer(TestLayer { | ||||
|         name: name.into(), | ||||
|         children: inner().collect(), | ||||
|     })) | ||||
| } | ||||
| 
 | ||||
| fn compare_all_org_document<P: AsRef<Path>>(root_dir: P) -> impl Iterator<Item = TestConfig> { | ||||
|     let root_dir = root_dir.as_ref(); | ||||
|     let test_files = WalkDir::new(root_dir) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander