# JavaInstanceofCmd.test --
#
# Tests the JavaInstanceofCmd class.
#
# Copyright (c) 1997 by Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# 2016 - reinserted in JBlend project
package require TTXN
# package under test is JBlend 2.0
package require JBlend 2.0
Name: JavaInstanceofCmd-1.1
Description: {cmdProc}
Test: {
java::instanceof
}
Expected: error {wrong # args: should be "java::instanceof object class"}
Name: JavaInstanceofCmd-1.2
Description: {cmdProc}
Test: {
java::instanceof foo
}
Expected: error {wrong # args: should be "java::instanceof object class"}
Name: JavaInstanceofCmd-1.3
Description: {cmdProc}
Test: {
java::instanceof foo bar blah
}
Expected: error {wrong # args: should be "java::instanceof object class"}
Name: JavaInstanceofCmd-1.4
Description: {cmdProc}
Test: {
java::instanceof kk foo
}
Expected: error {unknown java object "kk"}
Name: JavaInstanceofCmd-1.5
Description: {cmdProc}
Test: {
set o [java::new Object]
java::instanceof $o foo
}
Expected: error {unknown class "foo"}
Name: JavaInstanceofCmd-1.6
Description: {cmdProc}
Test: {
java::instanceof [java::null] Object
}
Expected: 0
Name: JavaInstanceofCmd-1.7
Description: {cmdProc}
Test: {
java::instanceof [java::null] java.lang.Object
}
Expected: 0
Name: JavaInstanceofCmd-1.8
Description: {cmdProc}
Test: {
java::instanceof [java::new Object] String
}
Expected: 0
Name: JavaInstanceofCmd-1.9
Description: {cmdProc}
Test: {
java::instanceof [java::new {String String} "kk"] String
}
Expected: 1
Name: JavaInstanceofCmd-1.10
Description: {cmdProc}
Test: {
java::instanceof [java::new {String String} "kk"] Object
}
Expected: 1
# === cleanup ========================================
::tcltest::cleanupTests
return