mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
test: save removing the nonexistent binary output for v fmt and v vet tests
This commit is contained in:
parent
2d867a2766
commit
60e718e7c6
@ -306,13 +306,15 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
|||||||
mut run_js := false
|
mut run_js := false
|
||||||
|
|
||||||
is_fmt := ts.vargs.contains('fmt')
|
is_fmt := ts.vargs.contains('fmt')
|
||||||
|
is_vet := ts.vargs.contains('vet')
|
||||||
|
produces_file_output := !(is_fmt || is_vet)
|
||||||
|
|
||||||
if relative_file.ends_with('js.v') {
|
if relative_file.ends_with('js.v') {
|
||||||
if !is_fmt {
|
if produces_file_output {
|
||||||
cmd_options << ' -b js'
|
cmd_options << ' -b js'
|
||||||
}
|
|
||||||
run_js = true
|
run_js = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if relative_file.contains('global') && !is_fmt {
|
if relative_file.contains('global') && !is_fmt {
|
||||||
cmd_options << ' -enable-globals'
|
cmd_options << ' -enable-globals'
|
||||||
@ -333,13 +335,13 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
|||||||
fname.replace('.v', '')
|
fname.replace('.v', '')
|
||||||
}
|
}
|
||||||
generated_binary_fpath := os.join_path_single(tmpd, generated_binary_fname)
|
generated_binary_fpath := os.join_path_single(tmpd, generated_binary_fname)
|
||||||
|
if produces_file_output {
|
||||||
if os.exists(generated_binary_fpath) {
|
if os.exists(generated_binary_fpath) {
|
||||||
if ts.rm_binaries {
|
if ts.rm_binaries {
|
||||||
os.rm(generated_binary_fpath) or {}
|
os.rm(generated_binary_fpath) or {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ts.vargs.contains('fmt') {
|
|
||||||
cmd_options << ' -o ${os.quoted_path(generated_binary_fpath)}'
|
cmd_options << ' -o ${os.quoted_path(generated_binary_fpath)}'
|
||||||
}
|
}
|
||||||
cmd := '${os.quoted_path(ts.vexe)} ' + cmd_options.join(' ') + ' ${os.quoted_path(file)}'
|
cmd := '${os.quoted_path(ts.vexe)} ' + cmd_options.join(' ') + ' ${os.quoted_path(file)}'
|
||||||
@ -421,11 +423,9 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if os.exists(generated_binary_fpath) {
|
if produces_file_output && os.exists(generated_binary_fpath) && ts.rm_binaries {
|
||||||
if ts.rm_binaries {
|
|
||||||
os.rm(generated_binary_fpath) or {}
|
os.rm(generated_binary_fpath) or {}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return pool.no_result
|
return pool.no_result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,13 +247,9 @@ fn (mut foptions FormatOptions) post_process_file(file string, formatted_file_pa
|
|||||||
if !is_formatted_different {
|
if !is_formatted_different {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
x := diff.color_compare_files(foptions.find_diff_cmd(), file, formatted_file_path)
|
|
||||||
if x.len != 0 {
|
|
||||||
println("$file is not vfmt'ed")
|
println("$file is not vfmt'ed")
|
||||||
return error('')
|
return error('')
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
|
||||||
if foptions.is_c {
|
if foptions.is_c {
|
||||||
if is_formatted_different {
|
if is_formatted_different {
|
||||||
eprintln('File is not formatted: $file')
|
eprintln('File is not formatted: $file')
|
||||||
|
@ -332,7 +332,10 @@ pub fn execute(cmd string) Result {
|
|||||||
// if cmd.contains(';') || cmd.contains('&&') || cmd.contains('||') || cmd.contains('\n') {
|
// if cmd.contains(';') || cmd.contains('&&') || cmd.contains('||') || cmd.contains('\n') {
|
||||||
// return Result{ exit_code: -1, output: ';, &&, || and \\n are not allowed in shell commands' }
|
// return Result{ exit_code: -1, output: ';, &&, || and \\n are not allowed in shell commands' }
|
||||||
// }
|
// }
|
||||||
pcmd := if cmd.contains('2>') { cmd } else { '$cmd 2>&1' }
|
pcmd := if cmd.contains('2>') { cmd.clone() } else { '$cmd 2>&1' }
|
||||||
|
defer {
|
||||||
|
unsafe { pcmd.free() }
|
||||||
|
}
|
||||||
f := vpopen(pcmd)
|
f := vpopen(pcmd)
|
||||||
if isnil(f) {
|
if isnil(f) {
|
||||||
return Result{
|
return Result{
|
||||||
|
@ -142,11 +142,11 @@ pub fn h_divider(divider string) string {
|
|||||||
// ==== TITLE =========================
|
// ==== TITLE =========================
|
||||||
pub fn header_left(text string, divider string) string {
|
pub fn header_left(text string, divider string) string {
|
||||||
plain_text := strip_ansi(text)
|
plain_text := strip_ansi(text)
|
||||||
xcols, _ := get_terminal_size()
|
xcols, _ := get_terminal_size() // can get 0 in lldb/gdb
|
||||||
cols := imax(1, xcols)
|
cols := imax(1, xcols)
|
||||||
relement := if divider.len > 0 { divider } else { ' ' }
|
relement := if divider.len > 0 { divider } else { ' ' }
|
||||||
hstart := relement.repeat(4)[0..4]
|
hstart := relement.repeat(4)[0..4]
|
||||||
remaining_cols := (cols - (hstart.len + 1 + plain_text.len + 1))
|
remaining_cols := imax(0, (cols - (hstart.len + 1 + plain_text.len + 1)))
|
||||||
hend := relement.repeat((remaining_cols + 1) / relement.len)[0..remaining_cols]
|
hend := relement.repeat((remaining_cols + 1) / relement.len)[0..remaining_cols]
|
||||||
return '$hstart $text $hend'
|
return '$hstart $text $hend'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user