大名鼎鼎的java动态脚本语言。已经通过了sun的认证

源代码在线查看: primitivetypefieldtest.groovy

软件大小: 1630 K
上传用户: hjf
关键词: java sun 动态 脚本
下载地址: 免注册下载 普通下载 VIP

相关代码

				class PrimitiveTypeFieldTest extends GroovyTestCase {				    private long longField				    private static short shortField								    void setValue() {				        longField = 1				    }								    def getValue() {				        def x = longField				        return x				    }								    void testPrimitiveField() {				        setValue()								        def value = getValue()				        assert value == 1								        assert longField == 1				    }								    void testIntParamBug() {				        assert bugMethod(123) == 246				        assert bugMethod2(123) == 246								        // @todo GROOVY-133				        def closure = {int x-> x * 2 }				        assert closure.call(123) == 246								    }								    int bugMethod(int x) {				        x * 2				    }								    def bugMethod2(int x) {				        x * 2				    }				    void testStaticPrimitiveField() {				        shortField = (Short) 123								        assert shortField == 123				    }								    void testIntLocalVariable() {				        int x = 123				        def y = x + 1				        assert y == 124				    }								    void testLongLocalVariable() {				        long x = 123				        def y = x + 1				        assert y == 124				    }				}							

相关资源