diff --git a/vlib/v/gen/c/testdata/autofree_toml.vv b/vlib/v/gen/c/testdata/autofree_toml.vv index 42272f8c0d..c4c99cbfc0 100644 --- a/vlib/v/gen/c/testdata/autofree_toml.vv +++ b/vlib/v/gen/c/testdata/autofree_toml.vv @@ -2,14 +2,8 @@ import toml import os -fn main() { - config_fname := 'config.toml' - tab_title := 'test tab title' - if !os.exists(config_fname) { - mut f := os.create(config_fname) or { panic(err) } - f.writeln('tab_title = "${tab_title}"') or { panic(err) } - f.close() - } - doc := toml.parse_file(config_fname) or { panic(err) } - assert doc.value('tab_title').string() == tab_title -} +config_fname := os.join_path(os.vtmp_dir(), 'config.toml') +tab_title := 'test tab title' +os.write_file(config_fname, 'tab_title = "${tab_title}"')! +doc := toml.parse_file(config_fname)! +assert doc.value('tab_title').string() == tab_title