Tcl Source Code

Check-in [085cbe212c]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:amend with fix (init of counter "i") and same tests for coro
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sebres-bug-723a2f4ac3
Files: files | file ages | folders
SHA3-256: 085cbe212c81b48e097f4e966aeb1c200735f9a32ebdf43f6a173ed987dfd6a6
User & Date: sebres 2018-08-02 17:30:36
Context
2018-08-03
11:15
amend with new tests: now contains all tests affected from [723a2f4ac3] as well as executed non-comp... check-in: 7d4bfdea1c user: sebres tags: sebres-bug-723a2f4ac3
2018-08-02
17:30
amend with fix (init of counter "i") and same tests for coro check-in: 085cbe212c user: sebres tags: sebres-bug-723a2f4ac3
17:09
amend to fix with test-cases covering correct behavior by tailcall with direct break/return into loo... check-in: cfe546af5b user: sebres tags: sebres-bug-723a2f4ac3
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/tailcall.test.

705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721

722
723







724
725
726
727
728
729
730
731
732
733

734
735







736
737
738
739
740
741
742
743
	}
	namespace delete [namespace current]
	p
    }
} -returnCodes 1 -result {namespace "::ns" not found}

# following tests cover tailcall as direct break/return from proc into proc
# or top-level upscope loop, in case of "infinite" loop the result is 10 
# (expected 1 for break and "" for return)
test tailcall-15.1a {as direct return from proc: break into proc upscope loop} -setup {
    proc p {} {tailcall break}
} -body {
    proc t {} {while {[incr i] < 10} p; set i}
    t
} -result 1
test tailcall-15.1b {as direct return from proc: break into top-level upscope loop} -setup {
    proc p {} {tailcall break}

} -body {
    while {[incr i] < 10} p; set i







} -result 1

test tailcall-15.2a {as direct return from proc: return into proc upscope loop} -setup {
    proc p {} {tailcall return}
} -body {
    proc t {} {while {[incr i] < 10} p; set i}
    t
} -result ""
test tailcall-15.2b {as direct return from proc: return into top-level upscope loop} -setup {
    proc p {} {tailcall return}

} -body {
    while {[incr i] < 10} p; set i







} -result ""

# cleanup
::tcltest::cleanupTests

# Local Variables:
# mode: tcl
# End:






|









>


>
>
>
>
>
>
>










>


>
>
>
>
>
>
>








705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
	}
	namespace delete [namespace current]
	p
    }
} -returnCodes 1 -result {namespace "::ns" not found}

# following tests cover tailcall as direct break/return from proc into proc
# coro or top-level upscope loop, in case of "infinite" loop the result is 10
# (expected 1 for break and "" for return)
test tailcall-15.1a {as direct return from proc: break into proc upscope loop} -setup {
    proc p {} {tailcall break}
} -body {
    proc t {} {while {[incr i] < 10} p; set i}
    t
} -result 1
test tailcall-15.1b {as direct return from proc: break into top-level upscope loop} -setup {
    proc p {} {tailcall break}
    set i 0
} -body {
    while {[incr i] < 10} p; set i
} -result 1
test tailcall-15.1c {as direct return from proc: break into top-level upscope loop} -setup {
    proc p {} {yield; tailcall break}
    set i 0
} -body {
    apply {{} {coroutine c p}}
    while {[incr i] < 10} c; set i
} -result 1

test tailcall-15.2a {as direct return from proc: return into proc upscope loop} -setup {
    proc p {} {tailcall return}
} -body {
    proc t {} {while {[incr i] < 10} p; set i}
    t
} -result ""
test tailcall-15.2b {as direct return from proc: return into top-level upscope loop} -setup {
    proc p {} {tailcall return}
    set i 0
} -body {
    while {[incr i] < 10} p; set i
} -result ""
test tailcall-15.2c {as direct return from proc: return into top-level upscope loop} -setup {
    proc p {} {yield; tailcall return}
    set i 0
} -body {
    apply {{} {coroutine c p}}
    while {[incr i] < 10} c; set i
} -result ""

# cleanup
::tcltest::cleanupTests

# Local Variables:
# mode: tcl
# End: