Hello,
Mo wrote:
> The best way to get regression test into Jacl is to get them into
> the Tcl 8.3 tests. [...] Right now, the
> Tcl 8.0 regression tests are used, but I want to switch everything
> over to the new tests ASAP.
But there are differences between Tcl8.0 and 8.3, e.g. in the clock
command the new option -milliseconds in the clicks subcommand.
Should we stay at our compatibility to 8.0, or should we try to
upgrade to 8.3 where possible? (This is trivial for -milliseconds:
Jacl return clicks in millis anyway...).
I downloaded the 8.3 clock.test from cvs and changed ClockCmd.java,
so that jacl passes the test with the modified clock.test.
Both patches are attached.
Greetings, Krischan
P.S.: Probably I will have some spare time around xmas, and maybe
I will find some time to implement another Tcl command for Jacl.
>From the list of missing commands, I found history or binary of
interest. If Jacl really upgrades to newer Tcl versions, I would
also consider the new subcommands of string.
What command is on top of the wishlist?
--
Christian Krone, SQL Datenbanksysteme GmbH
*** ClockCmd.java.monday Mon Nov 22 10:16:48 1999
--- ClockCmd.java Tue Nov 23 09:31:56 1999
***************
*** 39,44 ****
--- 39,50 ----
static final private int CMD_SCAN = 2;
static final private int CMD_SECONDS = 3;
+ static final private String clicksOpts[] = {
+ "-milliseconds"
+ };
+
+ static final private int OPT_CLICKS_MILLISECONDS = 0;
+
static final private String formatOpts[] = {
"-format",
"-gmt"
***************
*** 98,105 ****
switch (cmd) {
case CMD_CLICKS: {
! if (argv.length != 2) {
! throw new TclNumArgsException(interp, 2, argv, null);
}
long millis = System.currentTimeMillis();
int clicks = (int)(millis%Integer.MAX_VALUE);
--- 104,118 ----
switch (cmd) {
case CMD_CLICKS: {
! if (argv.length > 3) {
! throw new TclNumArgsException(interp, 2, argv,
! "?-milliseconds?");
! }
! if (argv.length == 3) {
! // We can safely ignore the -milliseconds options, since
! // we measure the clicks in milliseconds anyway...
! int clicksOpt = TclIndex.get(interp, argv[2],
! clicksOpts, "switch", 0);
}
long millis = System.currentTimeMillis();
int clicks = (int)(millis%Integer.MAX_VALUE);
*** clock.test.monday Mon Nov 22 10:34:38 1999
--- clock.test Tue Nov 23 09:31:38 1999
***************
*** 26,45 ****
concat {}
} {}
test clock-2.2 {clock clicks tests} {
- list [catch {clock clicks foo} msg] $msg
- } {1 {wrong # args: should be "clock clicks"}}
- test clock-2.3 {clock clicks tests} {
set start [clock clicks]
after 10
set end [clock clicks]
expr "$end > $start"
} {1}
# clock format
test clock-3.1 {clock format tests} {unixOnly} {
set clockval 657687766
clock format $clockval -format {%a %b %d %I:%M:%S %p %Y} -gmt true
} {Sun Nov 04 03:02:46 AM 1990}
test clock-3.2 {clock format tests} {
list [catch {clock format} msg] $msg
} {1 {wrong # args: should be "clock format clockval ?-format string? ?-gmt
boolean?"}}
--- 26,87 ----
concat {}
} {}
test clock-2.2 {clock clicks tests} {
set start [clock clicks]
after 10
set end [clock clicks]
expr "$end > $start"
} {1}
+ test clock-2.3 {clock clicks tests} {
+ list [catch {clock clicks foo} msg] $msg
+ } {1 {bad switch "foo": must be -milliseconds}}
+ test clock-2.3 {clock clicks tests} {
+ expr [clock clicks -milliseconds]+1
+ concat {}
+ } {}
+ test clock-2.2 {clock clicks tests, millisecond timing test} {
+ set start [clock clicks -milli]
+ after 10
+ set end [clock clicks -milli]
+ # assume, even with slow interp'ing, the diff is less than 60 msecs
+ expr {($end > $start) && (($end - $start) < 60)}
+ } {1}
# clock format
test clock-3.1 {clock format tests} {unixOnly} {
set clockval 657687766
clock format $clockval -format {%a %b %d %I:%M:%S %p %Y} -gmt true
} {Sun Nov 04 03:02:46 AM 1990}
+ test clock-3.2 {clock format tests} {
+ # TCL_USE_TIMEZONE_VAR
+
+ catch {set oldtz $env(TZ)}
+ set env(TZ) PST
+ set x {}
+ append x [clock format 863800000 -format %Z -gmt 1]
+ append x [set env(TZ)]
+ catch {unset env(TZ); set env(TZ) $oldtz}
+ set x
+ } {GMTPST}
+ test clock-3.3 {clock format tests} {
+ # tzset() under Borland doesn't seem to set up tzname[] for local
+ # timezone, which caused "clock format" to think that %Z was an invalid
+ # string. Don't care about answer, just that test runs w/o error.
+
+ clock format 863800000 -format %Z
+ set x {}
+ } {}
+ test clock-3.4 {clock format tests} {
+ # tzset() under Borland doesn't seem to set up tzname[] for gmt timezone.
+ # tzset() under MSVC has the following weird observed behavior:
+ # First time we call "clock format [clock seconds] -format %Z -gmt 1"
+ # we get "GMT", but on all subsequent calls we get the current time
+ # zone string, even though env(TZ) is GMT and the variable _timezone
+ # is 0.
+
+ set x {}
+ append x [clock format 863800000 -format %Z -gmt 1]
+ append x [clock format 863800000 -format %Z -gmt 1]
+ } {GMTGMT}
test clock-3.2 {clock format tests} {
list [catch {clock format} msg] $msg
} {1 {wrong # args: should be "clock format clockval ?-format string? ?-gmt
boolean?"}}
----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe: send mail to [EMAIL PROTECTED]
with the word SUBSCRIBE as the subject.
To unsubscribe: send mail to [EMAIL PROTECTED]
with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'.