2024-12-03 23:24:26 +00:00
|
|
|
use dust_lang::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn true_and_true_and_true() {
|
|
|
|
let source = "true && true && true";
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
compile(source),
|
|
|
|
Ok(Chunk::with_data(
|
|
|
|
None,
|
|
|
|
FunctionType {
|
|
|
|
type_parameters: None,
|
|
|
|
value_parameters: None,
|
2024-12-10 08:34:41 +00:00
|
|
|
return_type: Type::Boolean,
|
2024-12-03 23:24:26 +00:00
|
|
|
},
|
|
|
|
vec![
|
2024-12-10 08:34:41 +00:00
|
|
|
(Instruction::load_boolean(0, true, false), Span(0, 4)),
|
2024-12-03 23:24:26 +00:00
|
|
|
(Instruction::test(Argument::Register(0), true), Span(5, 7)),
|
|
|
|
(Instruction::jump(1, true), Span(5, 7)),
|
2024-12-10 08:34:41 +00:00
|
|
|
(Instruction::load_boolean(1, true, false), Span(8, 12)),
|
2024-12-03 23:24:26 +00:00
|
|
|
(Instruction::test(Argument::Register(1), true), Span(13, 15)),
|
|
|
|
(Instruction::jump(1, true), Span(13, 15)),
|
2024-12-10 08:34:41 +00:00
|
|
|
(Instruction::load_boolean(2, true, false), Span(16, 20)),
|
2024-12-03 23:24:26 +00:00
|
|
|
(Instruction::r#return(true), Span(20, 20)),
|
|
|
|
],
|
|
|
|
vec![],
|
|
|
|
vec![]
|
|
|
|
))
|
|
|
|
);
|
|
|
|
}
|