diff options
author | Steve Bennett <steveb@workware.net.au> | 2021-02-18 08:00:10 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2021-02-27 06:17:42 +1000 |
commit | 65a3a3209c778b8e554a9d2528da6ee385aa31ef (patch) | |
tree | 89f2ca3d2f344d3de2b6e740c204b1a53f7f7386 /tests/aio.test | |
parent | 86b1e2af7343aa0db4db5f00552e51d54d3df733 (diff) | |
download | jimtcl-65a3a3209c778b8e554a9d2528da6ee385aa31ef.zip jimtcl-65a3a3209c778b8e554a9d2528da6ee385aa31ef.tar.gz jimtcl-65a3a3209c778b8e554a9d2528da6ee385aa31ef.tar.bz2 |
aio: open: support for POSIX open flags
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/aio.test')
-rw-r--r-- | tests/aio.test | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/aio.test b/tests/aio.test index 4b04dbd..12e41ab 100644 --- a/tests/aio.test +++ b/tests/aio.test @@ -2,6 +2,7 @@ source [file dirname [info script]]/testing.tcl needs constraint jim testCmdConstraints socket +testConstraint unix [expr {$tcl_platform(platform) eq {unix}}] # Create and open in binary mode for compatibility between Windows and Unix set f [open testdata.in wb] @@ -11,6 +12,7 @@ set f [open testdata.in rb] defer { $f close + file delete testdata.in } test aio-1.1 {seek usage} -body { @@ -126,4 +128,32 @@ test aio-8.1 {filename} { $f filename } testdata.in +test aio-9.1 {open: posix modes} -constraints unix -body { + set in [open testdata.in RDONLY] + set buf [$in gets] + $in close + set buf +} -result {test-data} + +test aio-9.2 {open: posix modes, bad modes} -constraints unix -body { + open testdata.in {CREAT TRUNC} +} -returnCodes error -result {testdata.in: Invalid argument} + +test aio-9.3 {open: posix modes, bad modes} -constraints unix -body { + open testdata.in {WRONG TRUNC} +} -returnCodes error -result {bad access mode "WRONG": must be APPEND, BINARY, CREAT, EXCL, NOCTTY, RDONLY, RDWR, TRUNC, or WRONLY} + +test aio-9.4 {open: posix modes} -constraints unix -cleanup { + file delete testdata.out +} -body { + set out [open testdata.out {WRONLY CREAT TRUNC}] + $out puts write-data + $out close + # Now open for readwrite without truncate + set io [open testdata.out {RDWR CREAT}] + set buf [$io gets] + $io close + set buf +} -result {write-data} + testreport |