checker: update tests

pull/6622/head
Alexander Medvednikov 2020-10-15 12:39:32 +02:00
parent 7da1afa140
commit 3d4ab7de1e
3 changed files with 6 additions and 7 deletions

View File

@ -1,4 +1,4 @@
fn x(x,y int) { fn x(x int,y int) {
} }
fn main(){ fn main(){

View File

@ -90,7 +90,7 @@ fn test_all() {
assert total_errors == 0 assert total_errors == 0
} }
fn normalize_panic_message(message, vroot string) string { fn normalize_panic_message(message string, vroot string) string {
mut msg := message.all_before('=========================================') mut msg := message.all_before('=========================================')
msg = msg.replace(vroot + os.path_separator, '') msg = msg.replace(vroot + os.path_separator, '')
msg = msg.trim_space() msg = msg.trim_space()

View File

@ -34,14 +34,14 @@ pub fn full_path_to_v(dirs_in int) string {
return vexec return vexec
} }
fn diff_files(file_result, file_expected string) string { fn diff_files(file_result string, file_expected string) string {
diffcmd := util.find_working_diff_command() or { diffcmd := util.find_working_diff_command() or {
return err return err
} }
return util.color_compare_files(diffcmd, file_result, file_expected) return util.color_compare_files(diffcmd, file_result, file_expected)
} }
pub fn run_repl_file(wd, vexec, file string) ?string { pub fn run_repl_file(wd string, vexec string, file string) ?string {
vexec_folder := os.dir(vexec) + os.path_separator vexec_folder := os.dir(vexec) + os.path_separator
fcontent := os.read_file(file) or { fcontent := os.read_file(file) or {
return error('Could not read file $file') return error('Could not read file $file')
@ -60,8 +60,7 @@ pub fn run_repl_file(wd, vexec, file string) ?string {
} }
os.rm(input_temporary_filename) os.rm(input_temporary_filename)
result := r.output.replace('\r', '').replace('>>> ', '').replace('>>>', '').replace('... ', result := r.output.replace('\r', '').replace('>>> ', '').replace('>>>', '').replace('... ',
'').replace(wd + os.path_separator, '').replace(vexec_folder, '').replace(wd + os.path_separator, '').replace(vexec_folder, '').replace('\\', '/').trim_right('\n\r')
'').replace('\\', '/').trim_right('\n\r')
if result != output { if result != output {
file_result := '${file}.result.txt' file_result := '${file}.result.txt'
file_expected := '${file}.expected.txt' file_expected := '${file}.expected.txt'
@ -81,7 +80,7 @@ $diff
} }
} }
pub fn run_prod_file(wd, vexec, file string) ?string { pub fn run_prod_file(wd string, vexec string, file string) ?string {
file_expected := '${file}.expected.txt' file_expected := '${file}.expected.txt'
f_expected_content := os.read_file(file_expected) or { f_expected_content := os.read_file(file_expected) or {
return error('Could not read file $file') return error('Could not read file $file')