From af57035fd65cda96b7ec17e965184a922fdf6e82 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Thu, 30 Oct 2025 15:07:51 +0100 Subject: [PATCH] tests/core/io -> os2 --- tests/core/encoding/hxa/test_core_hxa.odin | 3 - tests/core/io/test_core_io.odin | 66 +++++----------------- 2 files changed, 14 insertions(+), 55 deletions(-) diff --git a/tests/core/encoding/hxa/test_core_hxa.odin b/tests/core/encoding/hxa/test_core_hxa.odin index 7f495e161..17b3ca619 100644 --- a/tests/core/encoding/hxa/test_core_hxa.odin +++ b/tests/core/encoding/hxa/test_core_hxa.odin @@ -1,6 +1,3 @@ -// Tests "core:encoding:hxa". -// Must be run with `-collection:tests=` flag, e.g. -// ./odin run tests/core/encoding/hxa/test_core_hxa.odin -out=tests/core/test_core_hxa -collection:tests=./tests package test_core_hxa import "core:encoding/hxa" diff --git a/tests/core/io/test_core_io.odin b/tests/core/io/test_core_io.odin index 10c9550cb..eb4d79317 100644 --- a/tests/core/io/test_core_io.odin +++ b/tests/core/io/test_core_io.odin @@ -1,13 +1,12 @@ package test_core_io -import "core:bufio" -import "core:bytes" -import "core:io" -import "core:log" -import "core:os" -import "core:os/os2" -import "core:strings" -import "core:testing" +import "core:bufio" +import "core:bytes" +import "core:io" +import "core:log" +import os "core:os/os2" +import "core:strings" +import "core:testing" Passed_Tests :: distinct io.Stream_Mode_Set @@ -540,7 +539,7 @@ test_string_builder_stream :: proc(t: ^testing.T) { } @test -test_os_file_stream :: proc(t: ^testing.T) { +test_os2_file_stream :: proc(t: ^testing.T) { defer if !testing.failed(t) { testing.expect_value(t, os.remove(TEMPORARY_FILENAME), nil) } @@ -550,51 +549,14 @@ test_os_file_stream :: proc(t: ^testing.T) { buf[i] = 'A' + i } - TEMPORARY_FILENAME :: "test_core_io_os_file_stream" - - fd, open_err := os.open(TEMPORARY_FILENAME, os.O_RDWR | os.O_CREATE | os.O_TRUNC, 0o644) - if !testing.expectf(t, open_err == nil, "error on opening %q: %v", TEMPORARY_FILENAME, open_err) { - return - } - - stream := os.stream_from_handle(fd) - - bytes_written, write_err := io.write(stream, buf[:]) - if !testing.expectf(t, bytes_written == len(buf) && write_err == nil, - "failed to Write initial buffer: bytes_written<%v> != len_buf<%v>, %v", bytes_written, len(buf), write_err) { - return - } - - flush_err := io.flush(stream) - if !testing.expectf(t, flush_err == nil, - "failed to Flush initial buffer: %v", write_err) { - return - } - - results, _ := _test_stream(t, stream, buf[:]) - - log.debugf("%#v", results) -} - -@test -test_os2_file_stream :: proc(t: ^testing.T) { - defer if !testing.failed(t) { - testing.expect_value(t, os2.remove(TEMPORARY_FILENAME), nil) - } - - buf: [32]u8 - for i in 0..