test: Simplified temp directory creaation.

This commit is contained in:
2026-06-24 15:25:20 -04:00
parent cd3e1b1110
commit 91d0800731
5 changed files with 36 additions and 42 deletions

View File

@@ -71,8 +71,7 @@ test_new_config_exclude_patterns :: proc(t: ^testing.T) {
@(test)
test_save_load_config_roundtrip :: proc(t: ^testing.T) {
base := fmt.tprintf("/tmp/envr-test-cfg-rt-%d", os.get_pid())
os.mkdir_all(base)
base := test_temp_dir(t, "envr-test-cfg-rt-*")
defer os.remove_all(base)
cfgPath, err := filepath.join([]string{base, "config.json"}, context.temp_allocator)
@@ -105,8 +104,7 @@ test_load_config_missing :: proc(t: ^testing.T) {
@(test)
test_save_config_no_clobber :: proc(t: ^testing.T) {
base := fmt.tprintf("/tmp/envr-test-cfg-noclobber-%d", os.get_pid())
os.mkdir_all(base)
base := test_temp_dir(t, "envr-test-cfg-noclobber-*")
defer os.remove_all(base)
cfgPath, err := filepath.join([]string{base, "config.json"}, context.temp_allocator)
@@ -123,8 +121,7 @@ test_save_config_no_clobber :: proc(t: ^testing.T) {
@(test)
test_save_config_force_overwrites :: proc(t: ^testing.T) {
base := fmt.tprintf("/tmp/envr-test-cfg-force-%d", os.get_pid())
os.mkdir_all(base)
base := test_temp_dir(t, "envr-test-cfg-force-*")
defer os.remove_all(base)
cfgPath, err := filepath.join([]string{base, "config.json"}, context.temp_allocator)