Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

root/trunk/base/src/pextlib1.0/tests/unsetenv.tcl

Revision 41638, 0.7 KB (checked in by blb@…, 2 months ago)

pextlib1.0/tests/unsetenv.tcl - add test for verifying 'unsetenv *' does
empty out the environment; use 'error' instead of 'exit' so the cause for
a failure is shown

Line 
1# Test file for Pextlib's unsetenv.
2# tclsh <Pextlib name>
3
4proc main {pextlibname} {
5    load $pextlibname
6
7    global env
8    puts [array get env]
9
10    array unset env *
11    puts [array get env]
12    if {[array size env] > 0} {
13        puts "note: your TclUnsetEnv is broken... (need to use unsetenv too)"
14    }
15    unsetenv *
16    puts [array get env]
17    if {[array size env] > 0} {
18        error "env not empty as expected"
19    }
20
21
22    set env(CC) "gcc"
23
24    array unset env CC
25    if {[info exists env(CC)]} {
26        puts "note: your TclUnsetEnv is broken... (need to use unsetenv too)"
27    }
28    unsetenv CC
29    if {[info exists env(CC)]} {
30        error "CC still set in env"
31    }
32}
33
34main $argv
Note: See TracBrowser for help on using the browser.