mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
tests: add cmd/tools/vdoc/tests/vdoc_file_test.v, extract a v.util.diff
module, cleanup
This commit is contained in:
parent
0aef92b613
commit
b6bd6d1d35
17 changed files with 212 additions and 128 deletions
|
@ -11,6 +11,7 @@ import v.ast
|
|||
import v.pref
|
||||
import v.fmt
|
||||
import v.util
|
||||
import v.util.diff
|
||||
import v.parser
|
||||
import vhelp
|
||||
|
||||
|
@ -203,25 +204,25 @@ fn (foptions &FormatOptions) post_process_file(file string, formatted_file_path
|
|||
return
|
||||
}
|
||||
if foptions.is_diff {
|
||||
diff_cmd := util.find_working_diff_command() or {
|
||||
diff_cmd := diff.find_working_diff_command() or {
|
||||
eprintln(err)
|
||||
return
|
||||
}
|
||||
if foptions.is_verbose {
|
||||
eprintln('Using diff command: $diff_cmd')
|
||||
}
|
||||
diff := util.color_compare_files(diff_cmd, file, formatted_file_path)
|
||||
diff := diff.color_compare_files(diff_cmd, file, formatted_file_path)
|
||||
if diff.len > 0 {
|
||||
println(diff)
|
||||
}
|
||||
return
|
||||
}
|
||||
if foptions.is_verify {
|
||||
diff_cmd := util.find_working_diff_command() or {
|
||||
diff_cmd := diff.find_working_diff_command() or {
|
||||
eprintln(err)
|
||||
return
|
||||
}
|
||||
x := util.color_compare_files(diff_cmd, file, formatted_file_path)
|
||||
x := diff.color_compare_files(diff_cmd, file, formatted_file_path)
|
||||
if x.len != 0 {
|
||||
println("$file is not vfmt'ed")
|
||||
return error('')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue