Add for loop

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2026-03-11 18:09:58 +01:00
parent 7182024342
commit 42e0056374
16 changed files with 775 additions and 44 deletions

View file

@ -2,6 +2,11 @@ use std::collections::HashMap;
use nomo::Context;
#[derive(serde::Serialize)]
struct Info {
context: HashMap<String, serde_json::Value>,
}
#[test]
fn check_cases() {
insta::glob!("cases/*.nomo", |path| {
@ -9,7 +14,6 @@ fn check_cases() {
settings.set_snapshot_path("cases");
settings.set_snapshot_suffix(path.file_stem().unwrap().display().to_string());
settings.set_prepend_module_to_snapshot(false);
let _guard = settings.bind_to_scope();
let input = std::fs::read_to_string(path).unwrap();
@ -21,14 +25,20 @@ fn check_cases() {
HashMap::new()
};
settings.set_info(&Info {
context: map.clone(),
});
let mut context = Context::new();
for (k, v) in map {
context.insert(k, v);
context.try_insert(k, v).unwrap();
}
let parsed = nomo::parser::parse(input.into()).unwrap();
let _guard = settings.bind_to_scope();
insta::assert_debug_snapshot!("1-parsed", parsed);
let ast = match nomo::ast::parse(parsed.tokens()) {