Fix tests

This commit is contained in:
0x4261756D 2023-01-23 06:08:26 +01:00
parent 476aa8bfb2
commit 131386632f
4 changed files with 14 additions and 6 deletions

View File

@ -986,12 +986,12 @@ fn interpret_program(operations: &Vec<Operation>, queue: &mut Vec<String>, funct
if position >= arr.length if position >= arr.length
{ {
//return Err(format!("Attempted an out of bounds write for array {} ({} >= {}) at {}:{}", arr.name, position, arr.length, line, col)); //return Err(format!("Attempted an out of bounds write for array {} ({} >= {}) at {}:{}", arr.name, position, arr.length, line, col));
return Err(String::from("Attempted array out-of-bounds access")); return Err(String::from("Attempted array out-of-bounds access\n"));
} }
if position < 0 if position < 0
{ {
//return Err(format!("Attempted an out of bounds write for array {} ({} < 0) at {}:{}", arr.name, position, line, col)); //return Err(format!("Attempted an out of bounds write for array {} ({} < 0) at {}:{}", arr.name, position, line, col));
return Err(String::from("Attempted array out-of-bounds access")); return Err(String::from("Attempted array out-of-bounds access\n"));
} }
let data = queue.remove(0); let data = queue.remove(0);
if debug if debug
@ -1010,12 +1010,12 @@ fn interpret_program(operations: &Vec<Operation>, queue: &mut Vec<String>, funct
if position >= arr.length if position >= arr.length
{ {
//return Err(format!("Attempted an out of bounds read for array {} ({} >= {}) at {}:{}", arr.name, position, arr.length, line, col)); //return Err(format!("Attempted an out of bounds read for array {} ({} >= {}) at {}:{}", arr.name, position, arr.length, line, col));
return Err(String::from("Attempted array out-of-bounds access")); return Err(String::from("Attempted array out-of-bounds access\n"));
} }
if position < 0 if position < 0
{ {
//return Err(format!("Attempted an out of bounds read for array {} ({} < 0) at {}:{}", arr.name, position, line, col)); //return Err(format!("Attempted an out of bounds read for array {} ({} < 0) at {}:{}", arr.name, position, line, col));
return Err(String::from("Attempted array out-of-bounds access")); return Err(String::from("Attempted array out-of-bounds access\n"));
} }
queue.push(arr.data[position as usize].clone()); queue.push(arr.data[position as usize].clone());
} }

View File

@ -1,3 +1,6 @@
//valid,true
//:END:
import "../std.qbl" import "../std.qbl"
true boolToStr println true boolToStr println

View File

@ -1,7 +1,8 @@
//valid,:END:
import "recursive_import_2.qbl" import "recursive_import_2.qbl"
import "recursive_import.qbl" import "recursive_import.qbl"
function => test function => test
{ {
"test" println
} }

View File

@ -1 +1,5 @@
import "recursive_import.qbl" //valid,test
//:END:
import "recursive_import.qbl"
test