Tcl Source Code

Check-in [d6a977a3a6]
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:Convert remaining env.test test-cases to tcltest-2 format
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d6a977a3a6eb72d43d6b628ac5403e0732d1873f
User & Date: jan.nijtmans 2016-02-22 12:39:10
Context
2016-02-26
16:17
Clean up unfired timer handlers or they cause errors in -singleproc 1 test run. check-in: 016412f1ec user: dgp tags: trunk
15:42
[80304238ac] Candidate fix for memleak due to RC cycle. check-in: 29d44ec30c user: dgp tags: bug-80304238ac
12:28
[dee3d66bc7] Start relaxing test constraints check-in: 19fab15fd6 user: gahr tags: gahr-ticket-dee3d66bc7
2016-02-23
19:44
merge trunk check-in: 4c431fc1c9 user: gahr tags: gahr-bug-5f71353740, tip-444
13:59
merge trunk check-in: c25ac5aa31 user: dgp tags: core-8-6-5-rc
2016-02-22
12:39
Convert remaining env.test test-cases to tcltest-2 format check-in: d6a977a3a6 user: jan.nijtmans tags: trunk
11:42
Fix [9b47029467631832]: testing existence of env(some_thing) destroys traces. With test-case demonst... check-in: d644df2cad user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/env.test.

274
275
276
277
278
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
    i eval { set env(THIS_SHOULD_EXIST) a}
    set     result [info exists env(THIS_SHOULD_EXIST)]
    lappend result [set env(THIS_SHOULD_EXIST)]
    lappend result [info exists env(THIS_SHOULD_EXIST)]
} -cleanup {
    interp delete i
} -result {1 a 1}
test env-5.5 {corner cases - cannot have null entries on Windows} {win} {
    set env() a
    catch {set env()}
} {1}

test env-6.1 {corner cases - add lots of env variables} {} {
    set size [array size env]
    for {set i 0} {$i < 100} {incr i} {
	set env(BOGUS$i) $i
    }
    expr {[array size env] - $size}
} 100

test env-7.1 {[219226]: whole env array should not be unset by read} {
    set n [array size env]
    set s [array startsearch env]
    while {[array anymore env $s]} {
	array nextelement env $s
	incr n -1
    }
    array donesearch env $s
    return $n
} 0

test env-7.2 {[219226]: links to env elements should not be removed by read} {
    apply {{} {
	set ::env(test7_2) ok
	upvar env(test7_2) elem
	set ::env(PATH)
	try {
	    return $elem
	} finally {
	    unset ::env(test7_2)
	}
    }}
} ok


test env-7.3 {[9b4702]: testing existence of env(some_thing) should not destroy trace} {
    apply {{} {
      catch {unset ::env(test7_3)}
      proc foo args {
        set ::env(test7_3) ok
      }
      trace add variable ::env(not_yet_existent) write foo
      info exists ::env(not_yet_existent)
      set ::env(not_yet_existent) "Now I'm here";
      info exists ::env(test7_3)
    }}
} 1

# Restore the environment variables at the end of the test.

foreach name [array names env] {
    unset env($name)
}
array set env $env2






|


|

|





|

|








|
>
|




<
|
<
<
|
<
<
>

|








|

|







274
275
276
277
278
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
    i eval { set env(THIS_SHOULD_EXIST) a}
    set     result [info exists env(THIS_SHOULD_EXIST)]
    lappend result [set env(THIS_SHOULD_EXIST)]
    lappend result [info exists env(THIS_SHOULD_EXIST)]
} -cleanup {
    interp delete i
} -result {1 a 1}
test env-5.5 {corner cases - cannot have null entries on Windows} -constraints win -body {
    set env() a
    catch {set env()}
} -result 1

test env-6.1 {corner cases - add lots of env variables} -body {
    set size [array size env]
    for {set i 0} {$i < 100} {incr i} {
	set env(BOGUS$i) $i
    }
    expr {[array size env] - $size}
} -result 100

test env-7.1 {[219226]: whole env array should not be unset by read} -body {
    set n [array size env]
    set s [array startsearch env]
    while {[array anymore env $s]} {
	array nextelement env $s
	incr n -1
    }
    array donesearch env $s
    return $n
} -result 0

test env-7.2 {[219226]: links to env elements should not be removed by read} -body {
    apply {{} {
	set ::env(test7_2) ok
	upvar env(test7_2) elem
	set ::env(PATH)

	return $elem


    }}


} -result ok

test env-7.3 {[9b4702]: testing existence of env(some_thing) should not destroy trace} -body {
    apply {{} {
      catch {unset ::env(test7_3)}
      proc foo args {
        set ::env(test7_3) ok
      }
      trace add variable ::env(not_yet_existent) write foo
      info exists ::env(not_yet_existent)
      set ::env(not_yet_existent) "Now I'm here";
      return [info exists ::env(test7_3)]
    }}
} -result 1

# Restore the environment variables at the end of the test.

foreach name [array names env] {
    unset env($name)
}
array set env $env2