This commit is contained in:
Jeff 2024-02-15 07:12:10 -05:00
parent a6e52e4ee6
commit e1c3e8bc0d
2 changed files with 6 additions and 7 deletions

View File

@ -80,6 +80,12 @@ impl AbstractTree for MapNode {
fn run(&self, _source: &str, _context: &Context) -> Result<Value, RuntimeError> {
let mut map = Map::new();
for (key, (statement, _)) in &self.properties {
let value = statement.run(_source, _context)?;
map.set(key.clone(), value);
}
Ok(Value::Map(map))
}
}

View File

@ -144,13 +144,6 @@ fn function() {
assert_eq!(&Type::Boolean, function.return_type());
}
#[test]
fn option() {
let result = interpret("x <option(int)> = some(1); x").unwrap();
assert_eq!(Value::Option(Some(Box::new(Value::Integer(1)))), result);
}
#[test]
fn range() {
assert_eq!(interpret("0..100"), Ok(Value::range(0, 100)));