1
0

Fix tests

This commit is contained in:
Jeff 2024-03-17 08:30:46 -04:00
parent 1b367d4dfb
commit 765decdd41
4 changed files with 517 additions and 607 deletions

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,7 @@ fn function_context_does_not_capture_values() {
), ),
Err(vec![Error::Validation { Err(vec![Error::Validation {
error: ValidationError::VariableNotFound(Identifier::new("x")), error: ValidationError::VariableNotFound(Identifier::new("x")),
position: (0, 0) position: (0, 0).into()
}]) }])
); );

View File

@ -141,10 +141,10 @@ fn map_type_errors() {
actual: Type::String, actual: Type::String,
expected: Type::Boolean expected: Type::Boolean
}, },
actual_position: (0, 0), actual_position: (0, 0).into(),
expected_position: (0, 0), expected_position: (0, 0).into(),
}, },
position: (0, 22) position: (0, 22).into()
}]) }])
); );
} }

View File

@ -30,10 +30,10 @@ fn set_variable_with_type_error() {
actual: Type::Boolean, actual: Type::Boolean,
expected: Type::String expected: Type::String
}, },
actual_position: (0, 0), actual_position: (0, 0).into(),
expected_position: (0, 0) expected_position: (0, 0).into()
}, },
position: (0, 18) position: (0, 18).into()
}]) }])
); );
} }
@ -43,16 +43,13 @@ fn function_variable() {
assert_eq!( assert_eq!(
interpret("foobar = (x: int): int { x }; foobar"), interpret("foobar = (x: int): int { x }; foobar"),
Ok(Some(Value::function( Ok(Some(Value::function(
vec![( vec![(Identifier::new("x"), Type::Integer.with_position((0, 0)))],
Identifier::new("x"), Type::Integer.with_position((0, 0)),
Type::Integer.with_position((0..0).into())
)],
Type::Integer.with_position((0..0).into()),
Block::new(vec![Statement::Expression(Expression::Identifier( Block::new(vec![Statement::Expression(Expression::Identifier(
Identifier::new("x") Identifier::new("x")
)) ))
.with_position((0..0).into())]) .with_position((0, 0))])
.with_position((0..0).into()) .with_position((0, 0))
))) )))
); );
} }