Diff
Not logged in

Differences From Artifact [bb582fb6b7]:

To Artifact [50b1c04776]:


484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
    puts $child "exit 3"
    list [catch {close $child} msg] $msg [lindex $::errorCode 0] \
        [lindex $::errorCode 2]
} {1 {child process exited abnormally} CHILDSTATUS 3}

test event-11.1 {Tcl_VwaitCmd procedure} {
    list [catch {vwait} msg] $msg
} {1 {wrong # args: should be "vwait ?options? name ?timeout?"}}
test event-11.2 {Tcl_VwaitCmd procedure} {
    list [catch {vwait a b} msg] $msg
} {1 {bad option "a": must be -idle, -noidle, -timer, -notimer, -file, -nofile, -window, -nowindow, -async, -noasync, -nowait, -wait, or idletasks}}
test event-11.3 {Tcl_VwaitCmd procedure} {
    catch {unset x}
    set x 1
    list [catch {vwait x(1)} msg] $msg







|







484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
    puts $child "exit 3"
    list [catch {close $child} msg] $msg [lindex $::errorCode 0] \
        [lindex $::errorCode 2]
} {1 {child process exited abnormally} CHILDSTATUS 3}

test event-11.1 {Tcl_VwaitCmd procedure} {
    list [catch {vwait} msg] $msg
} {1 {wrong # args: should be "vwait ?options? ?timeout? name"}}
test event-11.2 {Tcl_VwaitCmd procedure} {
    list [catch {vwait a b} msg] $msg
} {1 {bad option "a": must be -idle, -noidle, -timer, -notimer, -file, -nofile, -window, -nowindow, -async, -noasync, -nowait, -wait, or idletasks}}
test event-11.3 {Tcl_VwaitCmd procedure} {
    catch {unset x}
    set x 1
    list [catch {vwait x(1)} msg] $msg
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562





















563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586

    # limit should be exceeded (wait infinite):
    $i limit time -milliseconds 0
    lappend result 1. [catch {$i eval {vwait x}} msg] $msg

    # no limit in between:
    $i limit time -seconds {} -milliseconds {}
    lappend result 2. [catch {$i eval {vwait x 0}} msg] $msg

    # limit should be exceeded: (wait infinite by -1)
    $i limit time -milliseconds 0
    lappend result 3. [catch {$i eval {vwait x -1}} msg] $msg
    # limit should be exceeded (wait too long - 1000ms):
    $i limit time -milliseconds 0
    lappend result 4. [catch {$i eval {vwait x 1000}} msg] $msg

    set tout [clock seconds]; incr tout 10
    # wait timeout (before limit):
    $i limit time -seconds $tout
    lappend result 5. [catch {$i eval {vwait x 0}} msg] $msg
    # wait timeout (before limit):
    $i limit time -seconds $tout
    lappend result 6. [catch {$i eval {vwait x 10}} msg] $msg

    # wait successful (before limit):
    $i limit time -seconds $tout
    lappend result 7. [catch {$i eval {after 0 {set x ""}; vwait x 10}} msg] $msg

    interp delete $i
    set result
} [list \
    1. 1 {limit exceeded} \
    2. 0 0 \
    3. 1 {limit exceeded} \
    4. 1 {limit exceeded} \
    5. 0 0 \
    6. 0 0 \
    7. 0 1 \
]






















test event-11.4.1 {vwait with timeout} {} {
    foreach i [after info] {
	after cancel $i
    }
    set z {}
    set x {}
    # success cases:
    after 0 {lappend z 0}
    after 100 {lappend x 1}
    after 100 {lappend x 2}
    after 500 {lappend x 3}
    after 1000 {lappend x "error-too-slow"}
    vwait x 0; # no-wait
    lappend z $x; # 0 {} - (x still empty)
    vwait x 200; # wait up-to 200ms
    lappend z $x; # 0 {} {1 2}
    vwait x -1; # infinite wait
    lappend z $x; # 0 {} {1 2} {1 2 3}
    foreach i [after info] {
	after cancel $i
    }
    set z
} {0 {} {1 2} {1 2 3}}








|



|


|




|


|



|













>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|
|
|

|

|

|







523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607

    # limit should be exceeded (wait infinite):
    $i limit time -milliseconds 0
    lappend result 1. [catch {$i eval {vwait x}} msg] $msg

    # no limit in between:
    $i limit time -seconds {} -milliseconds {}
    lappend result 2. [catch {$i eval {vwait 0 x}} msg] $msg

    # limit should be exceeded: (wait infinite by -1)
    $i limit time -milliseconds 0
    lappend result 3. [catch {$i eval {vwait -1 x}} msg] $msg
    # limit should be exceeded (wait too long - 1000ms):
    $i limit time -milliseconds 0
    lappend result 4. [catch {$i eval {vwait 1000 x}} msg] $msg

    set tout [clock seconds]; incr tout 10
    # wait timeout (before limit):
    $i limit time -seconds $tout
    lappend result 5. [catch {$i eval {vwait 0 x}} msg] $msg
    # wait timeout (before limit):
    $i limit time -seconds $tout
    lappend result 6. [catch {$i eval {vwait 10 x}} msg] $msg

    # wait successful (before limit):
    $i limit time -seconds $tout
    lappend result 7. [catch {$i eval {after 0 {set x ""}; vwait 10 x}} msg] $msg

    interp delete $i
    set result
} [list \
    1. 1 {limit exceeded} \
    2. 0 0 \
    3. 1 {limit exceeded} \
    4. 1 {limit exceeded} \
    5. 0 0 \
    6. 0 0 \
    7. 0 1 \
]

test event-11.4.0 {vwait conditional with timeout (bypass timer)} {} {
    set x {}
    after 1000 {lappend x "error-too-slow"}
    after 0 {lappend x 1-timer}
    after 1 {lappend x 2-timer}
    after idle {lappend x 3-idle}
    vwait -async 50 x; # ignore all except async (timer also)
    lappend x 4-async
    vwait -idle 50 x; # ignore all except idle (timer also)
    lappend x 5-idle
    after idle {lappend x 6-idle}
    vwait 100 x; # now we accept timer events
    lappend x 7-idle
    vwait 100 x;
    # cleanup:
    foreach i [after info] {
	after cancel $i
    }
    set x
} {4-async 3-idle 5-idle 1-timer 2-timer 7-idle 6-idle}

test event-11.4.1 {vwait with timeout} {} {
    foreach i [after info] {
	after cancel $i
    }
    set z {}
    set x {}
    # success cases:
    after 0 {lappend z 0}
    after 50 {lappend x 1}
    after 50 {lappend x 2}
    after 250 {lappend x 3}
    after 1000 {lappend x "error-too-slow"}
    vwait 0 x; # no-wait
    lappend z $x; # 0 {} - (x still empty)
    vwait 200 x; # wait up-to 200ms
    lappend z $x; # 0 {} {1 2}
    vwait -1 x; # infinite wait
    lappend z $x; # 0 {} {1 2} {1 2 3}
    foreach i [after info] {
	after cancel $i
    }
    set z
} {0 {} {1 2} {1 2 3}}

742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
    lappend x 3
    after idle {lappend x idle}
    after 0 {lappend x 4}
    after 0 {lappend x 5}
    update -idle
    lappend x 6
    update
    lappend x res:[vwait x 500]
    set x
} {0 2 idle 3 idle 6 4 5 1 res:1}

test event-12.6 {update -timer, update -notimer} {
    foreach i [after info] {
	after cancel $i
    }







|







763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
    lappend x 3
    after idle {lappend x idle}
    after 0 {lappend x 4}
    after 0 {lappend x 5}
    update -idle
    lappend x 6
    update
    lappend x res:[vwait 500 x]
    set x
} {0 2 idle 3 idle 6 4 5 1 res:1}

test event-12.6 {update -timer, update -notimer} {
    foreach i [after info] {
	after cancel $i
    }
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
    lappend x 3
    after idle {lappend x idle.3}
    after 0 {lappend x 4}
    after 0 {lappend x 5}
    update -timer -idle
    lappend x 6
    update
    lappend x res:[vwait x 500]
    update -noidle
    lappend x 7
    update
    set x
} {idle.0 0a 2 idle.1a 0b idle.1b 3 4 5 idle.3 6 1 res:1 7 idle.2}

test event-13.1 {Tcl_WaitForFile procedure, readable} {testfilehandler} {







|







792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
    lappend x 3
    after idle {lappend x idle.3}
    after 0 {lappend x 4}
    after 0 {lappend x 5}
    update -timer -idle
    lappend x 6
    update
    lappend x res:[vwait 500 x]
    update -noidle
    lappend x 7
    update
    set x
} {idle.0 0a 2 idle.1a 0b idle.1b 3 4 5 idle.3 6 1 res:1 7 idle.2}

test event-13.1 {Tcl_WaitForFile procedure, readable} {testfilehandler} {