Tcl Source Code

Hex Artifact Content
Login

Artifact c86d0bd17f91732a28c8e5d0496b02a7c7e77d8e:

Attachment "chan.test.patch" to ticket [1586860fff] added by cleverly 2006-11-01 11:01:43.
0000: 2d 2d 2d 20 74 65 73 74 73 2f 63 68 61 6e 2e 74  --- tests/chan.t
0010: 65 73 74 2e 6f 72 69 67 09 32 30 30 36 2d 31 30  est.orig.2006-10
0020: 2d 32 39 20 31 33 3a 35 39 3a 33 35 2e 30 30 30  -29 13:59:35.000
0030: 30 30 30 30 30 30 20 2d 30 37 30 30 0a 2b 2b 2b  000000 -0700.+++
0040: 20 74 65 73 74 73 2f 63 68 61 6e 2e 74 65 73 74   tests/chan.test
0050: 09 32 30 30 36 2d 31 30 2d 33 31 20 32 30 3a 35  .2006-10-31 20:5
0060: 35 3a 34 32 2e 30 30 30 30 30 30 30 30 30 20 2d  5:42.000000000 -
0070: 30 37 30 30 0a 40 40 20 2d 32 34 2c 37 20 2b 32  0700.@@ -24,7 +2
0080: 34 2c 37 20 40 40 0a 20 7d 20 2d 72 65 74 75 72  4,7 @@. } -retur
0090: 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d 72 65  nCodes error -re
00a0: 73 75 6c 74 20 22 77 72 6f 6e 67 20 23 20 61 72  sult "wrong # ar
00b0: 67 73 3a 20 73 68 6f 75 6c 64 20 62 65 20 5c 22  gs: should be \"
00c0: 63 68 61 6e 20 73 75 62 63 6f 6d 6d 61 6e 64 20  chan subcommand 
00d0: 3f 61 72 67 75 6d 65 6e 74 20 2e 2e 2e 3f 5c 22  ?argument ...?\"
00e0: 22 0a 20 74 65 73 74 20 63 68 61 6e 2d 31 2e 32  ". test chan-1.2
00f0: 20 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 20 67   {chan command g
0100: 65 6e 65 72 61 6c 20 73 79 6e 74 61 78 7d 20 2d  eneral syntax} -
0110: 62 6f 64 79 20 7b 0a 20 20 20 20 20 63 68 61 6e  body {.     chan
0120: 20 46 4f 4f 42 41 52 0a 2d 7d 20 2d 72 65 74 75   FOOBAR.-} -retu
0130: 72 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d 72  rnCodes error -r
0140: 65 73 75 6c 74 20 22 75 6e 6b 6e 6f 77 6e 20 6f  esult "unknown o
0150: 72 20 61 6d 62 69 67 75 6f 75 73 20 73 75 62 63  r ambiguous subc
0160: 6f 6d 6d 61 6e 64 20 5c 22 46 4f 4f 42 41 52 5c  ommand \"FOOBAR\
0170: 22 3a 20 6d 75 73 74 20 62 65 20 62 6c 6f 63 6b  ": must be block
0180: 65 64 2c 20 63 6c 6f 73 65 2c 20 63 6f 6e 66 69  ed, close, confi
0190: 67 75 72 65 2c 20 63 6f 70 79 2c 20 63 72 65 61  gure, copy, crea
01a0: 74 65 2c 20 65 6f 66 2c 20 65 76 65 6e 74 2c 20  te, eof, event, 
01b0: 66 6c 75 73 68 2c 20 67 65 74 73 2c 20 6e 61 6d  flush, gets, nam
01c0: 65 73 2c 20 70 6f 73 74 65 76 65 6e 74 2c 20 70  es, postevent, p
01d0: 75 74 73 2c 20 72 65 61 64 2c 20 73 65 65 6b 2c  uts, read, seek,
01e0: 20 74 65 6c 6c 2c 20 6f 72 20 74 72 75 6e 63 61   tell, or trunca
01f0: 74 65 22 0a 2b 7d 20 2d 72 65 74 75 72 6e 43 6f  te".+} -returnCo
0200: 64 65 73 20 65 72 72 6f 72 20 2d 72 65 73 75 6c  des error -resul
0210: 74 20 22 75 6e 6b 6e 6f 77 6e 20 6f 72 20 61 6d  t "unknown or am
0220: 62 69 67 75 6f 75 73 20 73 75 62 63 6f 6d 6d 61  biguous subcomma
0230: 6e 64 20 5c 22 46 4f 4f 42 41 52 5c 22 3a 20 6d  nd \"FOOBAR\": m
0240: 75 73 74 20 62 65 20 61 76 61 69 6c 61 62 6c 65  ust be available
0250: 2c 20 62 6c 6f 63 6b 65 64 2c 20 63 6c 6f 73 65  , blocked, close
0260: 2c 20 63 6f 6e 66 69 67 75 72 65 2c 20 63 6f 70  , configure, cop
0270: 79 2c 20 63 72 65 61 74 65 2c 20 65 6f 66 2c 20  y, create, eof, 
0280: 65 76 65 6e 74 2c 20 66 6c 75 73 68 2c 20 67 65  event, flush, ge
0290: 74 73 2c 20 6e 61 6d 65 73 2c 20 70 6f 73 74 65  ts, names, poste
02a0: 76 65 6e 74 2c 20 70 75 74 73 2c 20 72 65 61 64  vent, puts, read
02b0: 2c 20 73 65 65 6b 2c 20 74 65 6c 6c 2c 20 6f 72  , seek, tell, or
02c0: 20 74 72 75 6e 63 61 74 65 22 0a 20 0a 20 74 65   truncate". . te
02d0: 73 74 20 63 68 61 6e 2d 32 2e 31 20 7b 63 68 61  st chan-2.1 {cha
02e0: 6e 20 63 6f 6d 6d 61 6e 64 3a 20 62 6c 6f 63 6b  n command: block
02f0: 65 64 20 73 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d  ed subcommand} -
0300: 62 6f 64 79 20 7b 0a 20 20 20 20 20 63 68 61 6e  body {.     chan
0310: 20 62 6c 6f 63 6b 65 64 20 66 6f 6f 20 62 61 72   blocked foo bar
0320: 0a 40 40 20 2d 39 36 2c 36 20 2b 39 36 2c 38 33  .@@ -96,6 +96,83
0330: 20 40 40 0a 20 20 20 20 20 63 61 74 63 68 20 7b   @@.     catch {
0340: 72 65 6d 6f 76 65 46 69 6c 65 20 24 66 69 6c 65  removeFile $file
0350: 7d 0a 20 7d 0a 20 0a 2b 23 20 54 49 50 20 32 38  }. }. .+# TIP 28
0360: 37 3a 20 63 68 61 6e 20 61 76 61 69 6c 61 62 6c  7: chan availabl
0370: 65 0a 2b 74 65 73 74 20 63 68 61 6e 2d 31 36 2e  e.+test chan-16.
0380: 31 20 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a  1 {chan command:
0390: 20 61 76 61 69 6c 61 62 6c 65 20 73 75 62 63 6f   available subco
03a0: 6d 6d 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b  mmand} -body {.+
03b0: 20 20 20 20 63 68 61 6e 20 61 76 61 69 6c 61 62      chan availab
03c0: 6c 65 20 66 6f 6f 20 62 61 72 0a 2b 7d 20 2d 72  le foo bar.+} -r
03d0: 65 74 75 72 6e 43 6f 64 65 73 20 65 72 72 6f 72  eturnCodes error
03e0: 20 2d 72 65 73 75 6c 74 20 22 77 72 6f 6e 67 20   -result "wrong 
03f0: 23 20 61 72 67 73 3a 20 73 68 6f 75 6c 64 20 62  # args: should b
0400: 65 20 5c 22 63 68 61 6e 20 61 76 61 69 6c 61 62  e \"chan availab
0410: 6c 65 20 63 68 61 6e 6e 65 6c 49 64 5c 22 22 0a  le channelId\"".
0420: 2b 74 65 73 74 20 63 68 61 6e 2d 31 36 2e 32 20  +test chan-16.2 
0430: 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 61  {chan command: a
0440: 76 61 69 6c 61 62 6c 65 20 73 75 62 63 6f 6d 6d  vailable subcomm
0450: 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20  and} -body {.+  
0460: 20 20 63 68 61 6e 20 61 76 61 69 6c 61 62 6c 65    chan available
0470: 20 73 74 64 6f 75 74 20 0a 2b 7d 20 2d 72 65 74   stdout .+} -ret
0480: 75 72 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d  urnCodes error -
0490: 72 65 73 75 6c 74 20 22 63 68 61 6e 6e 65 6c 20  result "channel 
04a0: 5c 22 73 74 64 6f 75 74 5c 22 20 77 61 73 6e 27  \"stdout\" wasn'
04b0: 74 20 6f 70 65 6e 65 64 20 66 6f 72 20 72 65 61  t opened for rea
04c0: 64 69 6e 67 22 0a 2b 74 65 73 74 20 63 68 61 6e  ding".+test chan
04d0: 2d 31 36 2e 33 20 7b 63 68 61 6e 20 63 6f 6d 6d  -16.3 {chan comm
04e0: 61 6e 64 3a 20 61 76 61 69 6c 61 62 6c 65 20 73  and: available s
04f0: 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d 62 6f 64 79  ubcommand} -body
0500: 20 7b 0a 2b 20 20 20 20 63 68 61 6e 20 61 76 61   {.+    chan ava
0510: 69 6c 61 62 6c 65 20 73 74 64 69 6e 0a 2b 7d 20  ilable stdin.+} 
0520: 2d 72 65 73 75 6c 74 20 30 0a 2b 74 65 73 74 20  -result 0.+test 
0530: 63 68 61 6e 2d 31 36 2e 34 20 7b 63 68 61 6e 20  chan-16.4 {chan 
0540: 63 6f 6d 6d 61 6e 64 3a 20 61 76 61 69 6c 61 62  command: availab
0550: 6c 65 20 73 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d  le subcommand} -
0560: 62 6f 64 79 20 7b 0a 2b 20 20 20 20 63 68 61 6e  body {.+    chan
0570: 20 61 76 61 69 6c 61 62 6c 65 20 46 4f 4f 42 41   available FOOBA
0580: 52 0a 2b 7d 20 2d 72 65 74 75 72 6e 43 6f 64 65  R.+} -returnCode
0590: 73 20 65 72 72 6f 72 20 2d 72 65 73 75 6c 74 20  s error -result 
05a0: 22 63 61 6e 20 6e 6f 74 20 66 69 6e 64 20 63 68  "can not find ch
05b0: 61 6e 6e 65 6c 20 6e 61 6d 65 64 20 5c 22 46 4f  annel named \"FO
05c0: 4f 42 41 52 5c 22 22 0a 2b 74 65 73 74 20 63 68  OBAR\"".+test ch
05d0: 61 6e 2d 31 36 2e 35 20 7b 63 68 61 6e 20 63 6f  an-16.5 {chan co
05e0: 6d 6d 61 6e 64 3a 20 61 76 61 69 6c 61 62 6c 65  mmand: available
05f0: 20 73 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d 73 65   subcommand} -se
0600: 74 75 70 20 7b 0a 2b 20 20 20 20 73 65 74 20 66  tup {.+    set f
0610: 69 6c 65 20 5b 6d 61 6b 65 46 69 6c 65 20 7b 7d  ile [makeFile {}
0620: 20 74 65 73 74 41 76 61 69 6c 61 62 6c 65 5d 0a   testAvailable].
0630: 2b 20 20 20 20 73 65 74 20 66 20 5b 6f 70 65 6e  +    set f [open
0640: 20 24 66 69 6c 65 20 77 2b 5d 0a 2b 20 20 20 20   $file w+].+    
0650: 63 68 61 6e 20 63 6f 6e 66 69 67 75 72 65 20 24  chan configure $
0660: 66 20 2d 74 72 61 6e 73 6c 61 74 69 6f 6e 20 6c  f -translation l
0670: 66 20 2d 62 75 66 66 65 72 69 6e 67 20 6c 69 6e  f -buffering lin
0680: 65 0a 2b 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20  e.+} -body {.+  
0690: 20 20 63 68 61 6e 20 70 75 74 73 20 24 66 20 66    chan puts $f f
06a0: 6f 6f 0a 2b 20 20 20 20 63 68 61 6e 20 70 75 74  oo.+    chan put
06b0: 73 20 24 66 20 62 61 72 0a 2b 20 20 20 20 63 68  s $f bar.+    ch
06c0: 61 6e 20 70 75 74 73 20 24 66 20 62 61 7a 0a 2b  an puts $f baz.+
06d0: 20 20 20 20 63 68 61 6e 20 73 65 65 6b 20 24 66      chan seek $f
06e0: 20 30 0a 2b 20 20 20 20 63 68 61 6e 20 67 65 74   0.+    chan get
06f0: 73 20 24 66 0a 2b 20 20 20 20 63 68 61 6e 20 61  s $f.+    chan a
0700: 76 61 69 6c 61 62 6c 65 20 24 66 0a 2b 7d 20 2d  vailable $f.+} -
0710: 72 65 73 75 6c 74 20 38 20 2d 63 6c 65 61 6e 75  result 8 -cleanu
0720: 70 20 7b 0a 2b 20 20 20 20 63 61 74 63 68 20 7b  p {.+    catch {
0730: 63 68 61 6e 20 63 6c 6f 73 65 20 24 66 7d 0a 2b  chan close $f}.+
0740: 20 20 20 20 63 61 74 63 68 20 7b 72 65 6d 6f 76      catch {remov
0750: 65 46 69 6c 65 20 24 66 69 6c 65 7d 0a 2b 7d 0a  eFile $file}.+}.
0760: 2b 74 65 73 74 20 63 68 61 6e 2d 31 36 2e 36 20  +test chan-16.6 
0770: 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 61  {chan command: a
0780: 76 61 69 6c 61 62 6c 65 20 73 75 62 63 6f 6d 6d  vailable subcomm
0790: 61 6e 64 7d 20 2d 73 65 74 75 70 20 7b 0a 2b 20  and} -setup {.+ 
07a0: 20 20 20 70 72 6f 63 20 63 68 61 6e 2d 31 36 2e     proc chan-16.
07b0: 36 2d 61 63 63 65 70 74 20 7b 73 6f 63 6b 20 61  6-accept {sock a
07c0: 64 64 72 20 70 6f 72 74 7d 20 7b 0a 2b 20 20 20  ddr port} {.+   
07d0: 20 20 20 20 20 63 68 61 6e 20 63 6f 6e 66 69 67       chan config
07e0: 75 72 65 20 24 73 6f 63 6b 20 2d 62 6c 6f 63 6b  ure $sock -block
07f0: 69 6e 67 20 30 20 2d 62 75 66 66 65 72 69 6e 67  ing 0 -buffering
0800: 20 6c 69 6e 65 20 2d 62 75 66 66 65 72 73 69 7a   line -buffersiz
0810: 65 20 33 32 0a 2b 20 20 20 20 20 20 20 20 63 68  e 32.+        ch
0820: 61 6e 20 65 76 65 6e 74 20 24 73 6f 63 6b 20 72  an event $sock r
0830: 65 61 64 61 62 6c 65 20 5b 6c 69 73 74 20 63 68  eadable [list ch
0840: 61 6e 2d 31 36 2e 36 2d 72 65 61 64 61 62 6c 65  an-16.6-readable
0850: 20 24 73 6f 63 6b 5d 0a 2b 20 20 20 20 7d 0a 2b   $sock].+    }.+
0860: 0a 2b 20 20 20 20 70 72 6f 63 20 63 68 61 6e 2d  .+    proc chan-
0870: 31 36 2e 36 2d 72 65 61 64 61 62 6c 65 20 7b 73  16.6-readable {s
0880: 6f 63 6b 7d 20 7b 0a 2b 20 20 20 20 20 20 20 20  ock} {.+        
0890: 73 65 74 20 72 20 5b 63 68 61 6e 20 67 65 74 73  set r [chan gets
08a0: 20 24 73 6f 63 6b 20 6c 69 6e 65 5d 0a 2b 20 20   $sock line].+  
08b0: 20 20 20 20 20 20 73 65 74 20 6c 20 5b 73 74 72        set l [str
08c0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 6c 69 6e 65  ing length $line
08d0: 5d 0a 2b 20 20 20 20 20 20 20 20 73 65 74 20 65  ].+        set e
08e0: 20 5b 63 68 61 6e 20 65 6f 66 20 24 73 6f 63 6b   [chan eof $sock
08f0: 5d 0a 2b 20 20 20 20 20 20 20 20 73 65 74 20 62  ].+        set b
0900: 20 5b 63 68 61 6e 20 62 6c 6f 63 6b 65 64 20 24   [chan blocked $
0910: 73 6f 63 6b 5d 0a 2b 20 20 20 20 20 20 20 20 73  sock].+        s
0920: 65 74 20 61 20 5b 63 68 61 6e 20 61 76 61 69 6c  et a [chan avail
0930: 61 62 6c 65 20 24 73 6f 63 6b 5d 0a 2b 0a 2b 20  able $sock].+.+ 
0940: 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 3a         lappend :
0950: 3a 63 68 61 6e 2d 31 36 2e 36 2d 64 61 74 61 20  :chan-16.6-data 
0960: 24 72 20 24 6c 20 24 65 20 24 62 20 24 61 0a 2b  $r $l $e $b $a.+
0970: 0a 2b 20 20 20 20 20 20 20 20 69 66 20 7b 24 72  .+        if {$r
0980: 20 21 3d 20 2d 31 20 7c 7c 20 24 65 20 7c 7c 20   != -1 || $e || 
0990: 24 6c 20 7c 7c 20 21 24 62 20 7c 7c 20 24 61 20  $l || !$b || $a 
09a0: 3e 20 31 32 38 7d 20 7b 0a 2b 20 20 20 20 20 20  > 128} {.+      
09b0: 20 20 20 20 20 20 73 65 74 20 64 61 74 61 20 5b        set data [
09c0: 72 65 61 64 20 24 73 6f 63 6b 20 24 61 5d 0a 2b  read $sock $a].+
09d0: 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70              lapp
09e0: 65 6e 64 20 3a 3a 63 68 61 6e 2d 31 36 2e 36 2d  end ::chan-16.6-
09f0: 64 61 74 61 20 5b 73 74 72 69 6e 67 20 72 61 6e  data [string ran
0a00: 67 65 20 24 64 61 74 61 20 30 20 32 5d 0a 2b 20  ge $data 0 2].+ 
0a10: 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65             lappe
0a20: 6e 64 20 3a 3a 63 68 61 6e 2d 31 36 2e 36 2d 64  nd ::chan-16.6-d
0a30: 61 74 61 20 5b 73 74 72 69 6e 67 20 72 61 6e 67  ata [string rang
0a40: 65 20 24 64 61 74 61 20 65 6e 64 2d 32 20 65 6e  e $data end-2 en
0a50: 64 5d 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20  d].+            
0a60: 73 65 74 20 3a 3a 63 68 61 6e 2d 31 36 2e 36 2d  set ::chan-16.6-
0a70: 64 6f 6e 65 20 31 0a 2b 20 20 20 20 20 20 20 20  done 1.+        
0a80: 7d 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20  }.+    }.+.+    
0a90: 70 72 6f 63 20 63 68 61 6e 2d 31 36 2e 36 2d 63  proc chan-16.6-c
0aa0: 6c 69 65 6e 74 20 7b 7d 20 7b 0a 2b 20 20 20 20  lient {} {.+    
0ab0: 20 20 20 20 63 68 61 6e 20 70 75 74 73 20 2d 6e      chan puts -n
0ac0: 6f 6e 65 77 6c 69 6e 65 20 24 3a 3a 63 6c 69 65  onewline $::clie
0ad0: 6e 74 20 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d  nt ABCDEFGHIJKLM
0ae0: 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 31 32 33  NOPQRSTUVWXYZ123
0af0: 34 35 36 37 38 39 30 0a 2b 20 20 20 20 20 20 20  4567890.+       
0b00: 20 63 68 61 6e 20 66 6c 75 73 68 20 24 3a 3a 63   chan flush $::c
0b10: 6c 69 65 6e 74 0a 2b 20 20 20 20 20 20 20 20 61  lient.+        a
0b20: 66 74 65 72 20 31 30 30 20 63 68 61 6e 2d 31 36  fter 100 chan-16
0b30: 2e 36 2d 63 6c 69 65 6e 74 0a 2b 20 20 20 20 7d  .6-client.+    }
0b40: 0a 2b 0a 2b 20 20 20 20 73 65 74 20 3a 3a 73 65  .+.+    set ::se
0b50: 72 76 65 72 20 5b 73 6f 63 6b 65 74 20 2d 73 65  rver [socket -se
0b60: 72 76 65 72 20 63 68 61 6e 2d 31 36 2e 36 2d 61  rver chan-16.6-a
0b70: 63 63 65 70 74 20 2d 6d 79 61 64 64 72 20 31 32  ccept -myaddr 12
0b80: 37 2e 30 2e 30 2e 31 20 30 5d 0a 2b 20 20 20 20  7.0.0.1 0].+    
0b90: 73 65 74 20 3a 3a 63 6c 69 65 6e 74 20 5b 73 6f  set ::client [so
0ba0: 63 6b 65 74 20 31 32 37 2e 30 2e 30 2e 31 20 5b  cket 127.0.0.1 [
0bb0: 6c 69 6e 64 65 78 20 5b 66 63 6f 6e 66 69 67 75  lindex [fconfigu
0bc0: 72 65 20 24 3a 3a 73 65 72 76 65 72 20 2d 73 6f  re $::server -so
0bd0: 63 6b 6e 61 6d 65 5d 20 32 5d 5d 0a 2b 20 20 20  ckname] 2]].+   
0be0: 20 73 65 74 20 3a 3a 63 68 61 6e 2d 31 36 2e 36   set ::chan-16.6
0bf0: 2d 64 61 74 61 20 5b 6c 69 73 74 5d 0a 2b 20 20  -data [list].+  
0c00: 20 20 73 65 74 20 3a 3a 63 68 61 6e 2d 31 36 2e    set ::chan-16.
0c10: 36 2d 64 6f 6e 65 20 30 0a 2b 7d 20 2d 62 6f 64  6-done 0.+} -bod
0c20: 79 20 7b 0a 2b 20 20 20 20 61 66 74 65 72 20 69  y {.+    after i
0c30: 64 6c 65 20 63 68 61 6e 2d 31 36 2e 36 2d 63 6c  dle chan-16.6-cl
0c40: 69 65 6e 74 20 0a 2b 20 20 20 20 76 77 61 69 74  ient .+    vwait
0c50: 20 3a 3a 63 68 61 6e 2d 31 36 2e 36 2d 64 6f 6e   ::chan-16.6-don
0c60: 65 0a 2b 20 20 20 20 73 65 74 20 3a 3a 63 68 61  e.+    set ::cha
0c70: 6e 2d 31 36 2e 36 2d 64 61 74 61 0a 2b 7d 20 2d  n-16.6-data.+} -
0c80: 72 65 73 75 6c 74 20 7b 2d 31 20 30 20 30 20 31  result {-1 0 0 1
0c90: 20 33 36 20 2d 31 20 30 20 30 20 31 20 37 32 20   36 -1 0 0 1 72 
0ca0: 2d 31 20 30 20 30 20 31 20 31 30 38 20 2d 31 20  -1 0 0 1 108 -1 
0cb0: 30 20 30 20 31 20 31 34 34 20 41 42 43 20 38 39  0 0 1 144 ABC 89
0cc0: 30 7d 20 2d 63 6c 65 61 6e 75 70 20 7b 0a 2b 20  0} -cleanup {.+ 
0cd0: 20 20 20 63 61 74 63 68 20 7b 63 68 61 6e 20 63     catch {chan c
0ce0: 6c 6f 73 65 20 24 63 6c 69 65 6e 74 7d 0a 2b 20  lose $client}.+ 
0cf0: 20 20 20 63 61 74 63 68 20 7b 63 68 61 6e 20 63     catch {chan c
0d00: 6c 6f 73 65 20 24 73 65 72 76 65 72 7d 0a 2b 20  lose $server}.+ 
0d10: 20 20 20 72 65 6e 61 6d 65 20 63 68 61 6e 2d 31     rename chan-1
0d20: 36 2e 36 2d 61 63 63 65 70 74 20 7b 7d 0a 2b 20  6.6-accept {}.+ 
0d30: 20 20 20 72 65 6e 61 6d 65 20 63 68 61 6e 2d 31     rename chan-1
0d40: 36 2e 36 2d 72 65 61 64 61 62 6c 65 20 7b 7d 0a  6.6-readable {}.
0d50: 2b 20 20 20 20 72 65 6e 61 6d 65 20 63 68 61 6e  +    rename chan
0d60: 2d 31 36 2e 36 2d 63 6c 69 65 6e 74 20 7b 7d 0a  -16.6-client {}.
0d70: 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f  +    unset -noco
0d80: 6d 70 6c 61 69 6e 20 3a 3a 63 68 61 6e 2d 31 36  mplain ::chan-16
0d90: 2e 36 2d 64 61 74 61 0a 2b 20 20 20 20 75 6e 73  .6-data.+    uns
0da0: 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 3a  et -nocomplain :
0db0: 3a 63 68 61 6e 2d 31 36 2e 36 2d 64 6f 6e 65 0a  :chan-16.6-done.
0dc0: 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f  +    unset -noco
0dd0: 6d 70 6c 61 69 6e 20 3a 3a 73 65 72 76 65 72 0a  mplain ::server.
0de0: 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f  +    unset -noco
0df0: 6d 70 6c 61 69 6e 20 3a 3a 63 6c 69 65 6e 74 0a  mplain ::client.
0e00: 2b 7d 0a 2b 0a 20 63 6c 65 61 6e 75 70 54 65 73  +}.+. cleanupTes
0e10: 74 73 0a 20 72 65 74 75 72 6e 0a 20 0a           ts. return. .