Tcl Source Code

Check-in [ac320d5dc6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Missing test cleanup.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ac320d5dc643e564644d7f55b642b9fcefcae520
User & Date: dgp 2012-09-14 18:15:54
Context
2012-09-14
18:20
Mistaken cleanup command. check-in: d614733809 user: dgp tags: trunk
18:15
Missing test cleanup. check-in: ac320d5dc6 user: dgp tags: trunk
2012-09-13
15:54
autoconf-2.59 check-in: 47f0dca723 user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/ioTrans.test.

279
280
281
282
283
284
285


286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302

303
304
305
306
307
308
309
310
311
312
313
314
315
316
317

318
319
320
321
322
323
324
325
326
327
328
329
330

331
332
333
334
335
336
337
338
339
340
341
342
343
344

345
346
347
348
349
350
351
352
353
354
355
356
357

358
359
360
361
362
363
364
365
366
367
368
369
370

371
372
373
374
375
376
377
378
379
380
381
382
383

384
385
386
387
388
389
390
391
392
393
394
395
396
397

398
399
400
401
402
403
404
    lappend res [set c [chan push [tempchan] foo]]
    rename foo {}
    lappend res [file channels file*]
    lappend res [file channels rt*]
    lappend res [catch {close $c} msg] $msg
    lappend res [file channels file*]
    lappend res [file channels rt*]


} -result {{initialize rt* {read write}} file* file* {} 1 {invalid command name "foo"} {} {}}
test iortrans-3.2 {chan finalize, for close} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return
    }
    lappend res [set c [chan push [tempchan] foo]]
    close $c
    # Close deleted the channel.
    lappend res [file channels rt*]
    # Channel destruction does not kill handler command!
    lappend res [info command foo]
} -cleanup {
    rename foo {}

} -result {{initialize rt* {read write}} file* {finalize rt*} {} foo}
test iortrans-3.3 {chan finalize, for close, error, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -code error 5
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
    # Channel is gone despite error.
    lappend res [file channels rt*]
} -cleanup {
    rename foo {}

} -result {{initialize rt* {read write}} file* {finalize rt*} 1 5 {}}
test iortrans-3.4 {chan finalize, for close, error, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	error FOO
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg $::errorInfo
} -cleanup {
    rename foo {}

} -result {{initialize rt* {read write}} file* {finalize rt*} 1 FOO {FOO
*"close $c"}}
test iortrans-3.5 {chan finalize, for close, arbitrary result, ignored} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return SOMETHING
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
} -cleanup {
    rename foo {}

} -result {{initialize rt* {read write}} file* {finalize rt*} 0 {}}
test iortrans-3.6 {chan finalize, for close, break, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -code 3
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
} -cleanup {
    rename foo {}

} -result {{initialize rt* {read write}} file* {finalize rt*} 1 *bad code*}
test iortrans-3.7 {chan finalize, for close, continue, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -code 4
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
} -cleanup {
    rename foo {}

} -result {{initialize rt* {read write}} file* {finalize rt*} 1 *bad code*}
test iortrans-3.8 {chan finalize, for close, custom code, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -code 777 BANG
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
} -cleanup {
    rename foo {}

} -result {{initialize rt* {read write}} file* {finalize rt*} 1 *bad code*}
test iortrans-3.9 {chan finalize, for close, ignore level, close error} -setup {
    set res {}
} -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -level 5 -code 777 BANG
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg opt] $msg
    noteOpts $opt
} -match glob -cleanup {
    rename foo {}

} -result {{initialize rt* {read write}} file* {finalize rt*} 1 *bad code* {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo *bad code*subcommand "finalize"*}}

# --- === *** ###########################
# method read (via read)

test iortrans-4.1 {chan read, transform call and return} -setup {
    set res {}







>
>

















>















>













>














>













>













>













>














>







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
    lappend res [set c [chan push [tempchan] foo]]
    rename foo {}
    lappend res [file channels file*]
    lappend res [file channels rt*]
    lappend res [catch {close $c} msg] $msg
    lappend res [file channels file*]
    lappend res [file channels rt*]
} -cleanup {
    tempdone
} -result {{initialize rt* {read write}} file* file* {} 1 {invalid command name "foo"} {} {}}
test iortrans-3.2 {chan finalize, for close} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return
    }
    lappend res [set c [chan push [tempchan] foo]]
    close $c
    # Close deleted the channel.
    lappend res [file channels rt*]
    # Channel destruction does not kill handler command!
    lappend res [info command foo]
} -cleanup {
    rename foo {}
    tempdone
} -result {{initialize rt* {read write}} file* {finalize rt*} {} foo}
test iortrans-3.3 {chan finalize, for close, error, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -code error 5
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
    # Channel is gone despite error.
    lappend res [file channels rt*]
} -cleanup {
    rename foo {}
    tempdone
} -result {{initialize rt* {read write}} file* {finalize rt*} 1 5 {}}
test iortrans-3.4 {chan finalize, for close, error, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	error FOO
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg $::errorInfo
} -cleanup {
    rename foo {}
    tempdone
} -result {{initialize rt* {read write}} file* {finalize rt*} 1 FOO {FOO
*"close $c"}}
test iortrans-3.5 {chan finalize, for close, arbitrary result, ignored} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return SOMETHING
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
} -cleanup {
    rename foo {}
    tempdone
} -result {{initialize rt* {read write}} file* {finalize rt*} 0 {}}
test iortrans-3.6 {chan finalize, for close, break, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -code 3
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
} -cleanup {
    rename foo {}
    tempdone
} -result {{initialize rt* {read write}} file* {finalize rt*} 1 *bad code*}
test iortrans-3.7 {chan finalize, for close, continue, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -code 4
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
} -cleanup {
    rename foo {}
    tempdone
} -result {{initialize rt* {read write}} file* {finalize rt*} 1 *bad code*}
test iortrans-3.8 {chan finalize, for close, custom code, close error} -setup {
    set res {}
} -match glob -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -code 777 BANG
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg] $msg
} -cleanup {
    rename foo {}
    tempdone
} -result {{initialize rt* {read write}} file* {finalize rt*} 1 *bad code*}
test iortrans-3.9 {chan finalize, for close, ignore level, close error} -setup {
    set res {}
} -body {
    proc foo {args} {
	lappend ::res $args
	handle.initialize
	return -level 5 -code 777 BANG
    }
    lappend res [set c [chan push [tempchan] foo]]
    lappend res [catch {close $c} msg opt] $msg
    noteOpts $opt
} -match glob -cleanup {
    rename foo {}
    tempdone
} -result {{initialize rt* {read write}} file* {finalize rt*} 1 *bad code* {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo *bad code*subcommand "finalize"*}}

# --- === *** ###########################
# method read (via read)

test iortrans-4.1 {chan read, transform call and return} -setup {
    set res {}
1032
1033
1034
1035
1036
1037
1038


1039
1040
1041
1042
1043
1044
1045
	proc driver {c sub args} {
	    return {initialize finalize read write}
	}
	set t [chan push $c [list driver $c]]
	chan event $c readable no-op
    }
    interp delete slave


} -result {}

# ### ### ### ######### ######### #########
## Same tests as above, but exercising the code forwarding and receiving
## driver operations to the originator thread.

# ### ### ### ######### ######### #########







>
>







1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
	proc driver {c sub args} {
	    return {initialize finalize read write}
	}
	set t [chan push $c [list driver $c]]
	chan event $c readable no-op
    }
    interp delete slave
} -cleanup {
    tempdone
} -result {}

# ### ### ### ######### ######### #########
## Same tests as above, but exercising the code forwarding and receiving
## driver operations to the originator thread.

# ### ### ### ######### ######### #########