diff options
author | sebres <sebres@users.sourceforge.net> | 2024-03-26 17:37:58 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2024-03-26 17:37:58 (GMT) |
commit | 7f782853a9f76e1ef4b39580531ecffa3b939b7f (patch) | |
tree | 3a712aa216fe06c09c4093241c237cb4c608d592 | |
parent | 0c9ff034f2eedd3b932503b5d5d38181cfc69971 (diff) | |
download | tcl-7f782853a9f76e1ef4b39580531ecffa3b939b7f.zip tcl-7f782853a9f76e1ef4b39580531ecffa3b939b7f.tar.gz tcl-7f782853a9f76e1ef4b39580531ecffa3b939b7f.tar.bz2 |
added missing test coverage for clock ensemble in safe-interpreter (shared from parent interpreter)
-rw-r--r-- | tests/clock.test | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/clock.test b/tests/clock.test index 893e410..b809ba1 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -273,21 +273,35 @@ proc ::testClock::registry { cmd path key } { # Base test cases: -test clock-0.1 "initial: auto-loading of ensemble and stubs on demand" { +test clock-0.1 "initial: auto-loading of ensemble and stubs on demand" -setup { set i [interp create]; # because clock can be used somewhere, test it in new interp: - - set ret [$i eval { - +} -body { + $i eval { lappend ret ens:[namespace ensemble exists ::clock] clock seconds; # init ensemble (but not yet stubs, loading of clock.tcl retarded) lappend ret ens:[namespace ensemble exists ::clock] lappend ret stubs:[expr {[namespace which -command ::tcl::clock::GetSystemTimeZone] ne ""}] clock format -now; # clock.tcl stubs expected lappend ret stubs:[expr {[namespace which -command ::tcl::clock::GetSystemTimeZone] ne ""}] - }] + } +} -cleanup { + interp delete $i +} -result {ens:0 ens:1 stubs:0 stubs:1} +test clock-0.1a "initial: safe interpreter shares clock command with parent" -setup { + set i [interp create] + $i eval {set sci [interp create -safe]} +} -body { + $i eval { + lappend ret ens:[namespace ensemble exists ::clock] + $sci eval { clock seconds }; # init ensemble (but not yet stubs, loading of clock.tcl retarded) + lappend ret ens:[namespace ensemble exists ::clock] + lappend ret stubs:[expr {[namespace which -command ::tcl::clock::GetSystemTimeZone] ne ""}] + $sci eval { clock format -now }; # clock.tcl stubs expected + lappend ret stubs:[expr {[namespace which -command ::tcl::clock::GetSystemTimeZone] ne ""}] + } +} -cleanup { interp delete $i - set ret -} {ens:0 ens:1 stubs:0 stubs:1} +} -result {ens:0 ens:1 stubs:0 stubs:1} test clock-0.2 "initial: loading of format/locale does not overwrite interp state (errorInfo)" -setup { # be sure - we have no cached locale/msgcat, etc: |