Skip to content

Commit 69b0256

Browse files
committed
clock.test: fixes bug [5137b4387019d0e1] (test clock with -singleproc 1); rewrite clock tests locale, timezone, environment (TZ, TCL_TZ) and also registry independent, also improve several setups/cleanups and usage of test-own registry
1 parent 0677389 commit 69b0256

File tree

2 files changed

+79
-214
lines changed

2 files changed

+79
-214
lines changed

lib/clock.tcl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,14 +668,17 @@ proc ::tcl::clock::EnterLocale { locale } {
668668

669669
#----------------------------------------------------------------------
670670
#
671+
# _registryExists --
671672
# _hasRegistry --
672673
#
673-
# Helper that checks whether registry module is available (Windows only)
674+
# Helpers that checks whether registry module is available (Windows only)
674675
# and loads it on demand.
675676
#
677+
# Side effects:
678+
# _hasRegistry does it only once, and hereafter simply returns 1 or 0.
679+
#
676680
#----------------------------------------------------------------------
677-
proc ::tcl::clock::_hasRegistry {} {
678-
set res 0
681+
proc ::tcl::clock::_registryExists {} {
679682
if { $::tcl_platform(platform) eq {windows} } {
680683
if { [catch { package require registry 1.1 }] } {
681684
# try to load registry directly from root (if uninstalled / development env):
@@ -687,9 +690,13 @@ proc ::tcl::clock::_hasRegistry {} {
687690
}}
688691
}
689692
if { [namespace which -command ::registry] ne "" } {
690-
set res 1
693+
return 1
691694
}
692695
}
696+
return 0
697+
}
698+
proc ::tcl::clock::_hasRegistry {} {
699+
set res [_registryExists]
693700
proc ::tcl::clock::_hasRegistry {} [list return $res]
694701
return $res
695702
}

0 commit comments

Comments
 (0)