mirror of
https://github.com/Dummi26/mers.git
synced 2025-12-14 11:16:17 +01:00
add some basic tests
This commit is contained in:
@@ -25,31 +25,10 @@ pub mod prelude_compile {
|
||||
|
||||
/// can be used to extend the mers config.
|
||||
/// with this, you can add values (usually functions),
|
||||
/// or add your own types to the language:
|
||||
/// or your own custom types to the language.
|
||||
///
|
||||
/// use mers_lib::prelude_extend_config::Config;
|
||||
/// fn add_thing(cfg: Config) -> Config {
|
||||
/// // use the methods on Config to add things (see the Config source code for examples)
|
||||
/// cfg.add_var("my_var".to_owned(), todo!())
|
||||
/// }
|
||||
///
|
||||
/// then use the Config when compiling and running your code, and your customizations will be available.
|
||||
/// Your customizations will only be available if you use
|
||||
/// the infos you got from calling `.infos()` on your `Config` after customizing it.
|
||||
pub mod prelude_extend_config {
|
||||
pub use crate::program::configs::Config;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_examples() {
|
||||
for example in std::fs::read_dir("../examples").unwrap() {
|
||||
let path = example.unwrap().path();
|
||||
eprintln!("Checking file {path:?}.");
|
||||
let src = prelude_compile::Source::new_from_file(path).unwrap();
|
||||
let (mut i1, _, mut i3) = prelude_compile::Config::new().bundle_std().infos();
|
||||
prelude_compile::parse(&mut src.clone(), &std::sync::Arc::new(src))
|
||||
.unwrap()
|
||||
.compile(&mut i1, program::parsed::CompInfo::default())
|
||||
.unwrap()
|
||||
.check(&mut i3, None)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user