tests: detect missing -o v.c files earlier
parent
24f5d0afc4
commit
5322a25690
|
@ -57,6 +57,11 @@ fn get_all_commands() []Command {
|
||||||
okmsg: 'V can compile hello world.'
|
okmsg: 'V can compile hello world.'
|
||||||
rmfile: 'examples/hello_world'
|
rmfile: 'examples/hello_world'
|
||||||
}
|
}
|
||||||
|
res << Command{
|
||||||
|
line: '$vexe -o hhww.c examples/hello_world.v'
|
||||||
|
okmsg: 'V can output a .c file, without compiling further.'
|
||||||
|
rmfile: 'hhww.c'
|
||||||
|
}
|
||||||
res << Command{
|
res << Command{
|
||||||
line: '$vexe -o vtmp cmd/v'
|
line: '$vexe -o vtmp cmd/v'
|
||||||
okmsg: 'V can compile itself.'
|
okmsg: 'V can compile itself.'
|
||||||
|
@ -126,7 +131,7 @@ fn get_all_commands() []Command {
|
||||||
okmsg: '`v -usecache` works.'
|
okmsg: '`v -usecache` works.'
|
||||||
rmfile: 'examples/tetris/tetris'
|
rmfile: 'examples/tetris/tetris'
|
||||||
}
|
}
|
||||||
$if macos {
|
$if macos || linux {
|
||||||
res << Command{
|
res << Command{
|
||||||
line: '$vexe -o v.c cmd/v && cc -Werror v.c && rm -rf a.out'
|
line: '$vexe -o v.c cmd/v && cc -Werror v.c && rm -rf a.out'
|
||||||
label: 'v.c should be buildable with no warnings...'
|
label: 'v.c should be buildable with no warnings...'
|
||||||
|
@ -152,13 +157,24 @@ fn (mut cmd Command) run() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if cmd.rmfile != '' {
|
if cmd.rmfile != '' {
|
||||||
os.rm(cmd.rmfile) or {}
|
mut file_existed := rm_existing(cmd.rmfile)
|
||||||
if os.user_os() == 'windows' {
|
if os.user_os() == 'windows' {
|
||||||
os.rm(cmd.rmfile + '.exe') or {}
|
file_existed = file_existed || rm_existing(cmd.rmfile + '.exe')
|
||||||
|
}
|
||||||
|
if !file_existed {
|
||||||
|
eprintln('Expected file did not exist: $cmd.rmfile')
|
||||||
|
cmd.ecode = 999
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try to remove a file, return if it existed before the removal attempt
|
||||||
|
fn rm_existing(path string) bool {
|
||||||
|
existed := os.exists(path)
|
||||||
|
os.rm(path) or {}
|
||||||
|
return existed
|
||||||
|
}
|
||||||
|
|
||||||
fn term_highlight(s string) string {
|
fn term_highlight(s string) string {
|
||||||
return term.colorize(term.yellow, term.colorize(term.bold, s))
|
return term.colorize(term.yellow, term.colorize(term.bold, s))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue