Tcltest consists mostly of pure Tcl scripts (some parts are C code to
be compiled, which I'd skip for Jacl). I'd just try the test suite,
see what does not work, and exclude those tests that have a justified
reason for not working under Jacl.
If you download the code from CVS, you'll find the following file:
tcltest.tcl, which is, indeed, what you are looking for.
I'm not sure that Jacl is a 100% implementation of Tcl though.
Googling for "tcltest jacl" brings, among others,
http://aspn.activestate.com/ASPN/Mail/Message/tcljava-user/824916
where it says:
"Thanks to a lot of hard work by Christian Krone, Jacl 1.3 is now able
to run the tcltest package from Tcl 8.3."
See http://tcljava.sourceforge.net/docs/website/index.html
> will the tcltest.tcl file supported by the jacl?
Yes - Jacl supports tcltest.
-- Neil
thanks
i have a same doubt for SWT.
does jacl support java SWT ?
It supports it in the same way that it supports any Java library -- just
"package require java" and then you can call methods, instantiate
objects etc from any available Java package on your classpath. For
instance, the following appears to work for me:
# simple Jacl/SWT example
package require java
java::import -package org.eclipse.swt SWT
java::import -package org.eclipse.swt.widgets Display Shell Label
set display [java::new Display]
set shell [java::new Shell $display]
set label [java::new Label $shell [java::field SWT NONE]]
$label setText "Hello, World!"
$label pack
$shell pack
$shell open
while {![$shell isDisposed]} {
if {![$display readAndDispatch]} { $display sleep }
}
$display dispose
For Swing-based GUIs there is Swank which has a Tk-like API.
-- Neil
>> does jacl support java SWT ?
>
>For Swing-based GUIs there is Swank which has a Tk-like API.
FYI Swank is at:
http://onemoonscientific.com/swank/
I haven't tried this myself, but there is a library that
emulates Swing on top of SWT, perhaps give that a try with
Swank:
http://swingwt.sourceforge.net/
--
Tom Poindexter
tpoi...@nyx.net
Simple example:
tcltest::testConstraint dingbatVar [info exists ::dingbat]
It *really* is that simple.
Donal.
1) "test" command is not recognized , when i use "package require
tcltest" command
to check the tcltest package version . it gives me "1.0". when i try
to update with tcltest 2.2.8. it shows the message "using tcl 8.0,
need tcl 8.3".
please provide the solution.
2)when i try to run the SWT example .
# simple Jacl/SWT example
package require java
java::import -package org.eclipse.swt SWT
java::import -package org.eclipse.swt.widgets Display Shell Label
set display [java::new Display]
set shell [java::new Shell $display]
set label [java::new Label $shell [java::field SWT NONE]]
$label setText "Hello, World!"
$label pack
$shell pack
$shell open
while {![$shell isDisposed]} {
if {![$display readAndDispatch]} { $display sleep }
}
$display dispose
it is not recognizing the class in the swt package. i already included
the "org.eclipse.swt_3.3.0.v3346 ;
org.eclipse.swt.win32.win32.x86_3.3.0.v3346;"jar files in classpath.
and using JDK1.5. if i am doing any mistake in configiring the things
please let me know.
thanks
Jacl officially only supports Tcl 8.0, but it actually has a number of
more recent features. You could try editing the tcltest package
(tcltest.tcl) to remove the [package require Tcl 8.3] line, but I can't
guarantee that it will work.
>
> 2)when i try to run the SWT example .
>
> # simple Jacl/SWT example
> package require java
>
>
> java::import -package org.eclipse.swt SWT
> java::import -package org.eclipse.swt.widgets Display Shell Label
>
>
> set display [java::new Display]
> set shell [java::new Shell $display]
> set label [java::new Label $shell [java::field SWT NONE]]
>
>
> $label setText "Hello, World!"
> $label pack
> $shell pack
> $shell open
> while {![$shell isDisposed]} {
> if {![$display readAndDispatch]} { $display sleep }
> }
> $display dispose
>
>
>
> it is not recognizing the class in the swt package. i already included
> the "org.eclipse.swt_3.3.0.v3346 ;
> org.eclipse.swt.win32.win32.x86_3.3.0.v3346;"jar files in classpath.
> and using JDK1.5. if i am doing any mistake in configiring the things
> please let me know.
This is definitely a classpath issue. You need to include the full path
to the jar file, i.e.: C:\foo\bar\swt.jar for Java to pick up classes
properly.
-- Neil
jacl 1.4.1 shows it has tcltest 1.0 package.
i create this small test file :
package require java
package require tcltest
test sum-1.1 {addition test} {
set sum [java::new Sum]
$sum add 10
$sum add 20
set total [$sum getSum]
} {30}
i am trying to execute by using following sequence of commands
java tcl.lang.Shell
source "file name "
it gives me following error message
invalid command name"test".
can you give some sugesstion.
If you look at the tcltest man page, it says:
package require tcltest ?2.3?
tcltest::test name description ?option value ...?
...
So the test command is in the tcltest namespace. Either specify that
when testing, or do
namespace import tcltest::*
after the package require tcltest.
Thanks ,
It is working , but when I include constraints block
like this in given code:
package require java
package require tcltest
namespace import tcltest::*
test sum-1.1 {addition test} -constraints{
unix
} -body{
set sum [java::new Sum]
$sum add 10
$sum add 20
set total [$sum getSum]
} -result 40
It gives me the following error
wrong # args: must be "test name description ?constraints? script
expectedAnswer"
As I told you tcltest package 1.0 is used by jacl 1.4.1.
is there any procedure to use the tcl2.2.8 with jacl 1.4.1.
Thanks
> unix
> } -body{
as should be here as well.
Remember: In Tcl white space is significant.
HTH
Helmut Giese
I make it that way also , still it doesn't work:-
package require java
package require tcltest
namespace import tcltest::*
test sum-1.1 { addition test } -constraints {
unix
} -body {
set sum [java::new Sum]
$sum add 10
$sum add 20
set total [$sum getSum]
} -result 40
Is any other modification required? Please suggest.
As the error message suggests, tcltest 1 only supports a simpler syntax:
test sum-1.1 {addition test} unix {
set sum [java::new Sum]
$sum add 10
$sum add 20
set total [$sum getSum]
} 40
-- Neil