aboutsummaryrefslogtreecommitdiff
path: root/tests/io.test
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2025-02-05 08:53:24 +1000
committerSteve Bennett <steveb@workware.net.au>2025-02-07 16:01:44 +1000
commitcaf9aae0155540357e2c68e31685772cdad26786 (patch)
tree5a5e214ee5101544e9214e770b183d9cd17201d4 /tests/io.test
parentb1b65e5cd9831b20ac9f27a58de861531be65a96 (diff)
downloadjimtcl-caf9aae0155540357e2c68e31685772cdad26786.zip
jimtcl-caf9aae0155540357e2c68e31685772cdad26786.tar.gz
jimtcl-caf9aae0155540357e2c68e31685772cdad26786.tar.bz2
aio: add support for translation binary|text
Mainly to support changing stdout,stderr to binary mode on Windows. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test26
1 files changed, 26 insertions, 0 deletions
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