1
0
dust/dust-lang/tests/logic/and_and.rs

43 lines
1.1 KiB
Rust
Raw Permalink Normal View History

2024-12-03 23:24:26 +00:00
use dust_lang::*;
2024-12-25 15:04:35 +00:00
use smallvec::smallvec;
2024-12-03 23:24:26 +00:00
#[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,
return_type: Type::Boolean,
2024-12-03 23:24:26 +00:00
},
2024-12-25 15:04:35 +00:00
smallvec![
Instruction::load_boolean(0, true, false),
Instruction::test(0, true),
Instruction::jump(1, true),
Instruction::load_boolean(1, true, false),
Instruction::test(1, true),
Instruction::jump(1, true),
Instruction::load_boolean(2, true, false),
Instruction::r#return(true),
2024-12-03 23:24:26 +00:00
],
2024-12-25 15:04:35 +00:00
smallvec![
Span(0, 4),
Span(5, 7),
Span(5, 7),
Span(8, 12),
Span(13, 15),
Span(13, 15),
Span(16, 20),
Span(20, 20)
],
smallvec![],
smallvec![],
2024-12-03 23:24:26 +00:00
vec![],
))
);
}