tests: autofree tmp expr test

pull/6245/head
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 handle_strings(s, p string) {
} }
fn str_expr() { fn str_tmp_expr() {
println('a' + 'b') // tmp expression result must be freed println('a' + 'b') // tmp expression result must be freed
handle_strings('c' + 'd', 'e' + 'f') 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() { fn str_replace() {
s := 'hello world' s := 'hello world'
r := s.replace('hello', 'hi') r := s.replace('hello', 'hi')
@ -35,7 +47,8 @@ fn str_replace() {
fn main() { fn main() {
println('start') println('start')
foo() foo()
// str_expr() str_tmp_expr()
str_inter()
// str_replace() // str_replace()
println('end') println('end')
} }

View File

@ -43,13 +43,19 @@ fn test_all() {
os.mkdir_all(wrkdir) os.mkdir_all(wrkdir)
os.chdir(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 basepath: valgrind_test_path
}) })
bench.set_total_expected_steps(tests.len) bench.set_total_expected_steps(tests.len)
for test in tests { for test in tests {
bench.step() bench.step()
exe_filename := '$wrkdir/x' 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 test in skip_valgrind_files {
$if !noskip ? { $if !noskip ? {