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

tests: unify all temporary files/folders under $VTMP/v, that can be cleaned by v wipe-cache (#15774)

This commit is contained in:
Delyan Angelov
2022-09-16 04:56:19 +03:00
committed by GitHub
parent 7e69619add
commit f922ed0941
28 changed files with 210 additions and 144 deletions

View File

@ -1,6 +1,16 @@
import os
import stbi
const tfolder = os.join_path(os.temp_dir(), 'v', 'stbi')
fn testsuite_begin() {
os.mkdir_all(tfolder) or {}
}
fn testsuite_end() {
os.rmdir_all(tfolder) or {}
}
fn test_stbi_read_write() {
vroot := @VEXEROOT
path := os.join_path(vroot, 'examples', 'assets', 'logo.png')
@ -8,7 +18,7 @@ fn test_stbi_read_write() {
d_s := stbi.load(path) or { panic(err) }
println('Image source data:\n $d_s')
out_path := os.join_path(os.temp_dir(), 'test.png')
out_path := os.join_path(tfolder, 'test.png')
println('Out path: $out_path')
stbi.stbi_write_png(out_path, d_s.width, d_s.height, 4, d_s.data, d_s.width * 4) or {
panic(err)