Tcl Source Code

Check-in [921106e91c]
Login

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

Overview
Comment:[Bug 3606397]: Make test work in isolation, and corrected what was being tested.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 921106e91cdb49ab99e69667ad89014734a58592
User & Date: dkf 2013-03-01 18:47:20
Context
2013-03-03
17:57
Unix terminal and serial port I/O: retire obsolete termio and sgtty code, general cleanup. See SF [... check-in: 993c21721a user: joe tags: trunk
2013-03-01
22:52
merge trunk: check-in: 89b0073ee3 user: dgp tags: dgp-refactor
18:47
[Bug 3606397]: Make test work in isolation, and corrected what was being tested. check-in: 921106e91c user: dkf tags: trunk
18:33
[Bug 3606542]: Add missing constraint to test. check-in: 068506d5f1 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/lmap.test.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# RCS: @(#) $Id: $

if {"::tcltest" ni [namespace children]} {
    package require tcltest 2
    namespace import -force ::tcltest::*
}

unset -nocomplain a i x

# ----- Non-compiled operation -----------------------------------------------

# Basic "lmap" operation (non-compiled)
test lmap-1.1 {basic lmap tests} {
    set a {}
    lmap i {a b c d} {







|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# RCS: @(#) $Id: $

if {"::tcltest" ni [namespace children]} {
    package require tcltest 2
    namespace import -force ::tcltest::*
}

unset -nocomplain a b i x

# ----- Non-compiled operation -----------------------------------------------

# Basic "lmap" operation (non-compiled)
test lmap-1.1 {basic lmap tests} {
    set a {}
    lmap i {a b c d} {
400
401
402
403
404
405
406
407


408
409
410
411


412



413
414
415
416
417
418
419
420
421
    }
} -body {
    demo
} -cleanup {
    rename demo {}
} -result {2 4}
# Huge lists must not overflow the bytecode interpreter (development bug)
test lmap-7.7 {huge list non-compiled} {


    set x [lmap a [lrepeat 1000000 x] { set b y$a }]
    list $b [llength $x] [string length $x]
} {yx 1000000 2999999}
test lmap-7.8 {huge list compiled} {


    set x [apply {{times} { lmap a [lrepeat $times x] { set b y$a }}} 1000000]



    list $b [llength $x] [string length $x]
} {yx 1000000 2999999}
test lmap-7.9 {error then dereference loop var (dev bug)} {
    catch { lmap a 0 b {1 2 3} { error x } }
    set a
} 0
test lmap-7.9a {error then dereference loop var (dev bug)} {
    catch { lmap a 0 b {1 2 3} { incr a $b; error x } }
    set a







|
>
>


|
|
>
>
|
>
>
>

|







400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
    }
} -body {
    demo
} -cleanup {
    rename demo {}
} -result {2 4}
# Huge lists must not overflow the bytecode interpreter (development bug)
test lmap-7.7 {huge list non-compiled} -setup {
    unset -nocomplain a b x
} -body {
    set x [lmap a [lrepeat 1000000 x] { set b y$a }]
    list $b [llength $x] [string length $x]
} -result {yx 1000000 2999999}
test lmap-7.8 {huge list compiled} -setup {
    unset -nocomplain a b x
} -body {
    set x [apply {{times} {
	global b
	lmap a [lrepeat $times x] { set b Y$a }
    }} 1000000]
    list $b [llength $x] [string length $x]
} -result {Yx 1000000 2999999}
test lmap-7.9 {error then dereference loop var (dev bug)} {
    catch { lmap a 0 b {1 2 3} { error x } }
    set a
} 0
test lmap-7.9a {error then dereference loop var (dev bug)} {
    catch { lmap a 0 b {1 2 3} { incr a $b; error x } }
    set a