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

tests: autofree tmp expr test

This commit is contained in:
Alexander Medvednikov 2020-08-28 10:08:29 +02:00
parent 39bf02ea68
commit 0890562663
2 changed files with 22 additions and 3 deletions

View File

@ -18,11 +18,23 @@ fn foo() {
fn handle_strings(s, p string) {
}
fn str_expr() {
fn str_tmp_expr() {
println('a' + 'b') // tmp expression result must be freed
handle_strings('c' + 'd', 'e' + 'f')
}
struct Foo {
a int
b string
}
fn str_inter() {
a := 10
println('a = $a')
// foo := Foo{10, 'x' + 'x'}
// println('foo = $foo') // TODO
}
fn str_replace() {
s := 'hello world'
r := s.replace('hello', 'hi')
@ -35,7 +47,8 @@ fn str_replace() {
fn main() {
println('start')
foo()
// str_expr()
str_tmp_expr()
str_inter()
// str_replace()
println('end')
}

View File

@ -43,13 +43,19 @@ fn test_all() {
os.mkdir_all(wrkdir)
os.chdir(wrkdir)
//
tests := vtest.filter_vtest_only(files.filter(it.ends_with('.v') && !it.ends_with('_test.v')), {
tests := vtest.filter_vtest_only(files.filter(it.ends_with('.v') && !it.ends_with('_test.v')),
{
basepath: valgrind_test_path
})
bench.set_total_expected_steps(tests.len)
for test in tests {
bench.step()
exe_filename := '$wrkdir/x'
if !test.starts_with('1.') {
bench.skip()
eprintln(bench.step_message_skip(test))
continue
}
//
if test in skip_valgrind_files {
$if !noskip ? {