TclBlend: Blending Tcl and Java

By Scott Stanton

Dr. Dobb's Journal February 1998

set obj [java::new Simple2 42 hello false]
set testdata {
    Prop1 42
    Prop2 hello
    Prop3 0
}
foreach {name value} $testdata {
    if {[string compare [$obj get$name] $value] != 0} {
    puts "got wrong value from property $name"
    }
}

Example 3: A table-driven test script that creates an instance of the Simple2 class, then checks the return values of all of the get methods.

Back to Article


Copyright © 1998, Dr. Dobb's Journal