Fix test; Pass all tests
This commit is contained in:
parent
f3fe03a95f
commit
c85958064a
@ -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 {
|
||||||
|
@ -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),
|
||||||
])))
|
])))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user