From 0e58c141f27f3b3376d140d0a9e4e9493b57b67e Mon Sep 17 00:00:00 2001
From: stepan <stepan.sindelar@oracle.com>
Date: Mon, 30 Jan 2017 16:39:00 +0100
Subject: [PATCH] Undo modifications to __S3MethodsTable__ in tests

---
 .../src/com/oracle/truffle/r/test/ExpectedTestOutput.test   | 6 +++---
 .../truffle/r/test/builtins/TestBuiltin_seq_along.java      | 3 ++-
 .../com/oracle/truffle/r/test/functions/TestS3Dispatch.java | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

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 42427b2a67..004520f152 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
@@ -57569,7 +57569,7 @@ integer(0)
 [49] 27795.92 28000.00
 
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_seq_along.testWithNonStandardLength#Ignored.Unimplemented#
-#{ assign('length.myclass', function(...) 42, envir=.__S3MethodsTable__.); x <- 1; class(x) <- 'myclass'; seq_along(x); }
+#{ assign('length.myclass', function(...) 42, envir=.__S3MethodsTable__.); x <- 1; class(x) <- 'myclass'; res <- seq_along(x); rm('length.myclass', envir=.__S3MethodsTable__.); res }
  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
 
@@ -72332,11 +72332,11 @@ attr(,".Environment")
 <environment: R_GlobalEnv>
 
 ##com.oracle.truffle.r.test.functions.TestS3Dispatch.testGenericDispatchThroughMethodsTable#
-#{ assign('Ops.myclass', function(a,b) 42, envir=.__S3MethodsTable__.); x<-1; class(x)<-'myclass'; x+x; }
+#{ assign('Ops.myclass', function(a,b) 42, envir=.__S3MethodsTable__.); x<-1; class(x)<-'myclass'; res <- x+x; rm('Ops.myclass', envir=.__S3MethodsTable__.); res; }
 [1] 42
 
 ##com.oracle.truffle.r.test.functions.TestS3Dispatch.testGenericDispatchThroughMethodsTable#
-#{ assign('[[.myclass', function(a,b) 42, envir=.__S3MethodsTable__.); x<-1; class(x)<-'myclass'; x[[99]]; }
+#{ assign('[[.myclass', function(a,b) 42, envir=.__S3MethodsTable__.); x<-1; class(x)<-'myclass'; res <- x[[99]]; rm('[[.myclass', envir=.__S3MethodsTable__.); res; }
 [1] 42
 
 ##com.oracle.truffle.r.test.functions.TestS3Dispatch.testMathGroupDispatch#
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_seq_along.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_seq_along.java
index 8cdf55201a..5435bb3a61 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_seq_along.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_seq_along.java
@@ -142,6 +142,7 @@ public class TestBuiltin_seq_along extends TestBase {
         // length defined in global env should not get us confused:
         assertEval("{ length <- function(x) 42; seq_along(c(1,2,3)) }");
         // length in __S3MethodsTable__ should work too, N.B.: needs complete S3 dispatch support
-        assertEval(Ignored.Unimplemented, "{ assign('length.myclass', function(...) 42, envir=.__S3MethodsTable__.); x <- 1; class(x) <- 'myclass'; seq_along(x); }");
+        assertEval(Ignored.Unimplemented,
+                        "{ assign('length.myclass', function(...) 42, envir=.__S3MethodsTable__.); x <- 1; class(x) <- 'myclass'; res <- seq_along(x); rm('length.myclass', envir=.__S3MethodsTable__.); res }");
     }
 }
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/functions/TestS3Dispatch.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/functions/TestS3Dispatch.java
index bc847b5fab..2c8c4652b6 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/functions/TestS3Dispatch.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/functions/TestS3Dispatch.java
@@ -138,8 +138,8 @@ public class TestS3Dispatch extends TestRBase {
     public void testGenericDispatchThroughMethodsTable() {
         // Note: `[.term` is "private" in stats, but it has entry in __S3MethodsTable__
         assertEval("terms(x~z)[1];");
-        assertEval("{ assign('Ops.myclass', function(a,b) 42, envir=.__S3MethodsTable__.); x<-1; class(x)<-'myclass'; x+x; }");
-        assertEval("{ assign('[[.myclass', function(a,b) 42, envir=.__S3MethodsTable__.); x<-1; class(x)<-'myclass'; x[[99]]; }");
+        assertEval("{ assign('Ops.myclass', function(a,b) 42, envir=.__S3MethodsTable__.); x<-1; class(x)<-'myclass'; res <- x+x; rm('Ops.myclass', envir=.__S3MethodsTable__.); res; }");
+        assertEval("{ assign('[[.myclass', function(a,b) 42, envir=.__S3MethodsTable__.); x<-1; class(x)<-'myclass'; res <- x[[99]]; rm('[[.myclass', envir=.__S3MethodsTable__.); res; }");
     }
 
     @Override
-- 
GitLab