mirror of
https://github.com/vlang/v.git
synced 2025-09-24 04:48:28 -04:00
tests: use os.vtmp_dir() in autofree_toml.vv, so it can be cleaned up automatically; simplify the code
This commit is contained in:
parent
97145ca3a8
commit
c2e2aac0c9
12
vlib/v/gen/c/testdata/autofree_toml.vv
vendored
12
vlib/v/gen/c/testdata/autofree_toml.vv
vendored
@ -2,14 +2,8 @@
|
|||||||
import toml
|
import toml
|
||||||
import os
|
import os
|
||||||
|
|
||||||
fn main() {
|
config_fname := os.join_path(os.vtmp_dir(), 'config.toml')
|
||||||
config_fname := 'config.toml'
|
|
||||||
tab_title := 'test tab title'
|
tab_title := 'test tab title'
|
||||||
if !os.exists(config_fname) {
|
os.write_file(config_fname, 'tab_title = "${tab_title}"')!
|
||||||
mut f := os.create(config_fname) or { panic(err) }
|
doc := toml.parse_file(config_fname)!
|
||||||
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
|
assert doc.value('tab_title').string() == tab_title
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user