add simple arguments test

This commit is contained in:
Robert Muir 2016-06-20 13:33:51 -04:00
parent 28b1b149ab
commit 006829e89b
1 changed files with 9 additions and 0 deletions

View File

@ -162,6 +162,15 @@ public class CastTests extends ScriptTestCase {
assertEquals(5, exec("def x = 5; return (int)x.longValue();"));
}
/**
* Currently these do not adopt the argument value, we issue a separate cast!
*/
public void testArgumentsDef() {
assertEquals(5, exec("def x = 5L; return (+(int)x);"));
assertEquals(6, exec("def x = 5; def y = 1L; return x + (int)y"));
assertEquals('b', exec("def x = 'abcdeg'; def y = 1L; x.charAt((int)y)"));
}
/**
* Unary operators adopt the return value
*/