From 6b25d17ef9262612b0b62dfc47ebada7ac974949 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:38:43 -0400 Subject: [PATCH 1/2] Add missing imports to `core` test suite --- tests/core/normal.odin | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/core/normal.odin b/tests/core/normal.odin index 7620d7d6e..cb49fed6b 100644 --- a/tests/core/normal.odin +++ b/tests/core/normal.odin @@ -19,6 +19,7 @@ download_assets :: proc() { @(require) import "encoding/json" @(require) import "encoding/varint" @(require) import "encoding/xml" +@(require) import "flags" @(require) import "fmt" @(require) import "math" @(require) import "math/big" @@ -37,3 +38,4 @@ download_assets :: proc() { @(require) import "text/match" @(require) import "thread" @(require) import "time" +@(require) import "unicode" From e3f4772d013217e94d0b64268e67107a49a0ef35 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:06:49 -0400 Subject: [PATCH 2/2] Fix removal of temporary file in `core:flags` test --- tests/core/flags/test_core_flags.odin | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/core/flags/test_core_flags.odin b/tests/core/flags/test_core_flags.odin index 71fc34701..e32c6832c 100644 --- a/tests/core/flags/test_core_flags.odin +++ b/tests/core/flags/test_core_flags.odin @@ -1113,6 +1113,13 @@ test_if_map_cstrings_get_freed :: proc(t: ^testing.T) { @(test) test_os_handle :: proc(t: ^testing.T) { + defer if !testing.failed(t) { + // Delete the file now that we're done. + // + // This is not done all the time, just in case the file is useful to debugging. + testing.expect_value(t, os.remove(TEMPORARY_FILENAME), os.ERROR_NONE) + } + TEMPORARY_FILENAME :: "test_core_flags_write_test_output_data" test_data := "Hellope!" @@ -1147,14 +1154,6 @@ test_os_handle :: proc(t: ^testing.T) { testing.expect_value(t, read_ok, true) file_contents_equal := 0 == bytes.compare(transmute([]u8)test_data, data) testing.expectf(t, file_contents_equal, "expected file contents to be the same, got %v", data) - - if file_contents_equal { - // Delete the file now that we're done. - // - // This is not done as a defer or all the time, just in case the file - // is useful to debugging. - testing.expect_value(t, os.remove(TEMPORARY_FILENAME), os.ERROR_NONE) - } } @(test)