1 source [file dirname [info script]]/testing.tcl
4 testCmdConstraints socket
6 # Create and open in binary mode for compatibility between Windows and Unix
7 set f [open testdata.in wb]
10 set f [open testdata.in rb]
16 test aio-1.1 {seek usage} -body {
18 } -returnCodes error -match glob -result {wrong # args: should be "* seek offset ?start|current|end"}
20 test aio-1.2 {seek start} -body {
25 test aio-1.3 {seek start} -body {
30 test aio-1.4 {read after seek} -body {
35 test aio-1.5 {seek backwards} -body {
41 test aio-1.6 {seek from end} -body {
45 } -result [list "a\n" 10]
47 test aio-1.7 {seek usage} -body {
49 } -returnCodes error -match glob -result {wrong # args: should be "* seek offset ?start|current|end"}
51 test aio-1.8 {seek usage} -body {
53 } -returnCodes error -match glob -result {expected integer but got "badint"}
55 test aio-1.9 {seek bad pos} -body {
57 } -returnCodes error -match glob -result {testdata.in: Invalid argument}
59 test aio-2.1 {read usage} -body {
61 } -returnCodes error -result {bad option "-nonoption": must be -nonewline, or -pending}
63 test aio-2.2 {read usage} -body {
65 } -returnCodes error -result {expected integer but got "badint"}
67 test aio-2.3 {read -ve len} -body {
69 } -returnCodes error -result {invalid parameter: negative len}
71 test aio-2.4 {read too many args} -body {
73 } -returnCodes error -match glob -result {wrong # args: should be "* read ?-nonewline|-pending|len?"}
75 test aio-2.5 {read -pending on non-ssl} -body {
77 } -returnCodes error -result {-pending not supported on this connection type}
79 test aio-3.1 {copy to invalid fh} -body {
81 } -returnCodes error -result {Not a filehandle: "lambda"}
83 test aio-3.2 {copy bad length} -body {
84 $f copy stdout invalid
85 } -returnCodes error -result {expected integer but got "invalid"}
89 test aio-4.1 {gets invalid var} -body {
91 } -returnCodes error -result {can't set "badvar(abc)": variable isn't array}
93 test aio-5.1 {puts usage} -body {
94 stdout puts -badopt abc
95 } -returnCodes error -result {wrong # args: should be "stdout puts ?-nonewline? str"}
103 # eof won't trigger until we try to read
113 test aio-7.1 {close args} -constraints socket -body {
115 } -returnCodes error -result {bad option "badopt": must be -nodelete, r, or w}
117 test aio-7.2 {close w on non-socket} -constraints socket -body {
119 } -returnCodes error -match regexp -result {^(Socket operation on non-socket|Not a socket)$}
121 test aio-7.3 {close -nodelete on non-socket} -constraints socket -body {
123 } -returnCodes error -result {not supported}
125 test aio-8.1 {filename} {