1
0

Fix test; Pass all tests

This commit is contained in:
Jeff 2024-07-11 17:54:59 -04:00
parent f3fe03a95f
commit c85958064a
2 changed files with 7 additions and 3 deletions

View File

@ -67,7 +67,11 @@ impl AbstractNode for ValueNode {
) -> Result<(), ValidationError> { ) -> Result<(), ValidationError> {
if let ValueNode::List(list) = self { if let ValueNode::List(list) = self {
let mut items = list.into_iter(); let mut items = list.into_iter();
let first_item = items.next().unwrap(); let first_item = if let Some(item) = items.next() {
item
} else {
return Ok(());
};
let first_item_type = if let Some(r#type) = first_item.expected_type(context)? { let first_item_type = if let Some(r#type) = first_item.expected_type(context)? {
r#type r#type
} else { } else {

View File

@ -87,11 +87,11 @@ fn string() {
#[test] #[test]
fn list() { fn list() {
assert_eq!( assert_eq!(
interpret("test", "[1, 2, 'foobar']"), interpret("test", "[1, 2, 3]"),
Ok(Some(Value::list(vec![ Ok(Some(Value::list(vec![
Value::integer(1), Value::integer(1),
Value::integer(2), Value::integer(2),
Value::string("foobar".to_string()), Value::integer(3),
]))) ])))
); );
} }