From caf9aae0155540357e2c68e31685772cdad26786 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Wed, 5 Feb 2025 08:53:24 +1000 Subject: aio: add support for translation binary|text Mainly to support changing stdout,stderr to binary mode on Windows. Signed-off-by: Steve Bennett --- tests/io.test | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/io.test (limited to 'tests/io.test') diff --git a/tests/io.test b/tests/io.test new file mode 100644 index 0000000..1b06439 --- /dev/null +++ b/tests/io.test @@ -0,0 +1,26 @@ +source [file dirname [info script]]/testing.tcl + +# This is a proxy for tcl || tclcompat +constraint cmd fconfigure + +# The tests in this file are intended to test Tcl-compatible I/O features + +test io-1.1 {translation binary} -body { + # write a file via stdout in binary mode + # This will always work on Unix + set script { + fconfigure stdout -translation binary + puts line1 + puts line2 + } + exec [info nameofexecutable] << $script >binary.out + # Read it back in binary mode + set f [open binary.out rb] + set buf [read $f] + close $f + set buf +} -cleanup { + file delete binary.out +} -result "line1\nline2\n" + +testreport -- cgit v1.1