From 5e2cfd405ae9e81e2e5c75c95a62d381d3ee4996 Mon Sep 17 00:00:00 2001
From: Tomas Stupka <tomas.stupka@oracle.com>
Date: Fri, 10 Aug 2018 17:06:16 +0200
Subject: [PATCH] added as.integer testcase

---
 .../src/com/oracle/truffle/r/test/ExpectedTestOutput.test   | 6 ++++++
 .../truffle/r/test/builtins/TestBuiltin_asinteger.java      | 1 +
 2 files changed, 7 insertions(+)

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 cab492ed4f..b6e0412752 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 dff1e558d9..bd7f280d73 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)) }");
-- 
GitLab