tests: add vlib/v/tests/profile/profile_test.v regression test

pull/7555/head
Delyan Angelov 2020-12-25 14:30:22 +02:00
parent 2c1e545d24
commit a631078d8a
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,10 @@
import net.http
fn main() {
if resp := http.get('http://127.0.0.1:56713/unknown_page') {
println(resp.text)
} else {
println(err)
}
assert true
}

View File

@ -0,0 +1,21 @@
import os
const (
vexe = os.getenv('VEXE')
vroot = os.dir(vexe)
)
fn test_vexe_exists() {
assert vexe.len > 0
assert os.is_file(vexe)
}
fn test_v_profile_works() {
res := os.exec('"$vexe" -profile - run vlib/v/tests/profile/calling_http_get.v') or { panic(err) }
// eprintln('res: $res')
assert res.exit_code == 0
assert res.output.len > 0
assert res.output.starts_with('net: socket error')
assert res.output.contains(' main__main')
assert res.output.contains(' os__init_os_args')
}