From 3734b92b956e72d5e585e98d17e33fdce98e699d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Mar 2024 09:26:46 +0000 Subject: Make "clock configure" an internal command "::tcl::clock::configure" --- generic/tclClock.c | 2 +- library/init.tcl | 2 +- tests/clock-ivm.test | 2 +- tests/clock.test | 28 ++++++++++++++-------------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a4d2ab7..af977eb 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -942,7 +942,7 @@ TimezoneLoaded( * * ClockConfigureObjCmd -- * - * This function is invoked to process the Tcl "clock configure" command. + * This function is invoked to process the Tcl "::clock::configure" (internal) command. * * Usage: * ::tcl::clock::configure ?-option ?value?? diff --git a/library/init.tcl b/library/init.tcl index 9306986..2fcd074 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -111,7 +111,7 @@ if {[interp issafe]} { proc clock args { set cmdmap [dict create] - foreach cmd {add clicks format microseconds milliseconds scan seconds configure} { + foreach cmd {add clicks format microseconds milliseconds scan seconds} { dict set cmdmap $cmd ::tcl::clock::$cmd } namespace inscope ::tcl::clock [list namespace ensemble create -command \ diff --git a/tests/clock-ivm.test b/tests/clock-ivm.test index 13de0b3..c6ac394 100644 --- a/tests/clock-ivm.test +++ b/tests/clock-ivm.test @@ -4,5 +4,5 @@ # # See the file "clock.test" for more information. -clock configure -valid [expr {![clock configure -valid]}] +::tcl::clock::configure -valid [expr {![::tcl::clock::configure -valid]}] source [file join [file dirname [info script]] clock.test] \ No newline at end of file diff --git a/tests/clock.test b/tests/clock.test index 2a3557c..5436051 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -34,7 +34,7 @@ testConstraint y2038 \ # Test with both validity modes - validate on / off: -set valid_mode [clock configure -valid] +set valid_mode [::tcl::clock::configure -valid] # Wrapper to show validity mode in the test-case name (for possible errors): proc test {args} { @@ -44,7 +44,7 @@ proc test {args} { } puts [outputChannel] " Validity default mode: [expr {$valid_mode ? "on": "off"}]" -testConstraint valid_off [expr {![clock configure -valid]}] +testConstraint valid_off [expr {![::tcl::clock::configure -valid]}] if {[namespace which -command ::tcl::unsupported::timerate] ne ""} { namespace import ::tcl::unsupported::timerate @@ -37141,13 +37141,13 @@ test clock-46.16$idx {freescan: validation rules: invalid day of week} \ _invalid_test "Sat Jan 02 00:00:00 1970$relstr" "Thu Jan 04 00:00:00 1970$relstr" } -result [lrepeat 10 1 {unable to convert input string: invalid day of week}] test clock-46.17$idx {scan: validation rules: invalid year} -setup { - set orgcfg [list -min-year [clock configure -min-year] -max-year [clock configure -max-year] \ - -year-century [clock configure -year-century] -century-switch [clock configure -century-switch]] - clock configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 + set orgcfg [list -min-year [::tcl::clock::configure -min-year] -max-year [::tcl::clock::configure -max-year] \ + -year-century [::tcl::clock::configure -year-century] -century-switch [::tcl::clock::configure -century-switch]] + ::tcl::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 } -body { _invalid_test "70-01-01$relstr" "1870-01-01$relstr" "9570-01-01$relstr" } -result [lrepeat 15 1 {unable to convert input string: invalid year}] -cleanup { - clock configure {*}$orgcfg + ::tcl::clock::configure {*}$orgcfg unset -nocomplain orgcfg } @@ -37285,23 +37285,23 @@ test clock-46.29-2 {scan: validation rules: valid day of leap/not leap year} \ [clock format [clock scan "365-2017" -format "%j-%G" -valid 1 -gmt 1] -format "%d-%m-%Y"] } -result {31-12-2016 31-12-2017 31-12-2016 31-12-2017} test clock-46.30 {scan: validation rules: invalid year} -setup { - set orgcfg [list -min-year [clock configure -min-year] -max-year [clock configure -max-year] \ - -year-century [clock configure -year-century] -century-switch [clock configure -century-switch]] - clock configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 + set orgcfg [list -min-year [::tcl::clock::configure -min-year] -max-year [::tcl::clock::configure -max-year] \ + -year-century [::tcl::clock::configure -year-century] -century-switch [::tcl::clock::configure -century-switch]] + ::tcl::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 } -body { _invalid_test "01-01-70" "%d-%m-%y" "01-01-1870" "%d-%m-%C%y" "01-01-1970" "%d-%m-%Y" } -result [lrepeat 15 1 {unable to convert input string: invalid year}] -cleanup { - clock configure {*}$orgcfg + ::tcl::clock::configure {*}$orgcfg unset -nocomplain orgcfg } test clock-46.31 {scan: validation rules: invalid iso year} -setup { - set orgcfg [list -min-year [clock configure -min-year] -max-year [clock configure -max-year] \ - -year-century [clock configure -year-century] -century-switch [clock configure -century-switch]] - clock configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 + set orgcfg [list -min-year [::tcl::clock::configure -min-year] -max-year [::tcl::clock::configure -max-year] \ + -year-century [::tcl::clock::configure -year-century] -century-switch [::tcl::clock::configure -century-switch]] + ::tcl::clock::configure -min-year 2000 -max-year 2100 -year-century 2000 -century-switch 38 } -body { _invalid_test "01-01-70" "%d-%m-%g" "01-01-9870" "%d-%m-%C%g" "01-01-9870" "%d-%m-%G" } -result [lrepeat 15 1 {unable to convert input string: invalid iso year}] -cleanup { - clock configure {*}$orgcfg + ::tcl::clock::configure {*}$orgcfg unset -nocomplain orgcfg } rename _invalid_test {} -- cgit v0.12