MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_for_empty

Function test_for_empty

core/src/parser.rs:4124–4168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4122
4123 #[test]
4124 fn test_for_empty() {
4125 let auto_iter = VarRef::new("i", None);
4126 do_ok_test(
4127 "FOR i = 1 TO 10\nNEXT",
4128 &[Statement::For(ForSpan {
4129 iter: auto_iter.clone(),
4130 iter_pos: lc(1, 5),
4131 iter_double: false,
4132 start: expr_integer(1, 1, 9),
4133 end: Expr::LessEqual(Box::from(BinaryOpSpan {
4134 lhs: expr_symbol(auto_iter.clone(), 1, 5),
4135 rhs: expr_integer(10, 1, 14),
4136 pos: lc(1, 11),
4137 })),
4138 next: Expr::Add(Box::from(BinaryOpSpan {
4139 lhs: expr_symbol(auto_iter, 1, 5),
4140 rhs: expr_integer(1, 1, 1),
4141 pos: lc(1, 11),
4142 })),
4143 body: vec![],
4144 })],
4145 );
4146
4147 let typed_iter = VarRef::new("d", Some(ExprType::Double));
4148 do_ok_test(
4149 "FOR d# = 1.0 TO 10.2\nREM Nothing to do\nNEXT",
4150 &[Statement::For(ForSpan {
4151 iter: typed_iter.clone(),
4152 iter_pos: lc(1, 5),
4153 iter_double: false,
4154 start: expr_double(1.0, 1, 10),
4155 end: Expr::LessEqual(Box::from(BinaryOpSpan {
4156 lhs: expr_symbol(typed_iter.clone(), 1, 5),
4157 rhs: expr_double(10.2, 1, 17),
4158 pos: lc(1, 14),
4159 })),
4160 next: Expr::Add(Box::from(BinaryOpSpan {
4161 lhs: expr_symbol(typed_iter, 1, 5),
4162 rhs: expr_integer(1, 1, 1),
4163 pos: lc(1, 14),
4164 })),
4165 body: vec![],
4166 })],
4167 );
4168 }
4169
4170 #[test]
4171 fn test_for_incrementing() {

Callers

nothing calls this directly

Calls 5

lcFunction · 0.85
expr_integerFunction · 0.85
expr_symbolFunction · 0.85
expr_doubleFunction · 0.85
do_ok_testFunction · 0.70

Tested by

no test coverage detected