1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fix repl tests

This commit is contained in:
Alexander Medvednikov 2019-11-18 02:34:46 +03:00
parent 32fbc2bdf3
commit e081791eaf
3 changed files with 12 additions and 2 deletions

View File

@ -9,3 +9,7 @@
// res.free() // res.free()
// conn.close() // conn.close()
// } // }
fn main() {
}

View File

@ -57,3 +57,7 @@ fn main() {
} }
*/ */
fn main() {
}

View File

@ -439,7 +439,7 @@ pub fn (v mut V) generate_main() {
cgen.genln('$cgen.fn_main;') cgen.genln('$cgen.fn_main;')
v.gen_main_end('return 0') v.gen_main_end('return 0')
} }
else { else if !v.pref.is_repl {
verror('function `main` is not declared in the main module') verror('function `main` is not declared in the main module')
} }
} }
@ -453,7 +453,9 @@ pub fn (v mut V) generate_main() {
// Generate a C `main`, which calls every single test function // Generate a C `main`, which calls every single test function
v.gen_main_start(false) v.gen_main_start(false)
if v.pref.is_stats { cgen.genln('BenchedTests bt = main__start_testing();') } if v.pref.is_stats {
cgen.genln('BenchedTests bt = main__start_testing();')
}
for _, f in v.table.fns { for _, f in v.table.fns {
if f.name.starts_with('main__test_') { if f.name.starts_with('main__test_') {