diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index cab492ed4f6b4acb93dd3d27a12d087359c51ebb..b6e04127529a09f58ad887e7920e4d434e2d59de 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -7262,6 +7262,12 @@ Error: (list) object cannot be coerced to type 'integer' #{ as.integer.cls <- function(x) 42; as.integer(structure(c(1,2), class='cls')); } [1] 42 +##com.oracle.truffle.r.test.builtins.TestBuiltin_asinteger.testAsInteger#Output.IgnoreWarningContext# +#{ f <- function() as.integer(10+2i); f() } +[1] 10 +Warning message: +In f() : imaginary parts discarded in coercion + ##com.oracle.truffle.r.test.builtins.TestBuiltin_asinteger.testAsInteger# #{ x<-c(a=1.1, b=2.2); dim(x)<-c(1,2); attr(x, "foo")<-"foo"; y<-as.integer(x); attributes(y) } NULL diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asinteger.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asinteger.java index dff1e558d942c4ac14007c559e22f05eed1201b8..bd7f280d73abd5fa3c5a4603b971dd074f0c468a 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asinteger.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asinteger.java @@ -138,6 +138,7 @@ public class TestBuiltin_asinteger extends TestBase { assertEval("{ as.integer(-0/0) }"); assertEval("{ as.integer(as.raw(c(1,2,3,4))) }"); assertEval("{ as.integer(10+2i) }"); + assertEval(Output.IgnoreWarningContext, "{ f <- function() as.integer(10+2i); f() }"); assertEval("{ as.integer(c(3+3i, 4+4i)) }"); assertEval("{ as.integer(10000000000000) }"); assertEval("{ as.integer(list(c(1),2,3)) }");