Skip to content
Snippets Groups Projects
Commit 0cbd8000 authored by Florian Angerer's avatar Florian Angerer
Browse files

Sessions could not be save for empty workspaces since...

Sessions could not be save for empty workspaces since LoadSaveFunctions.SaveToConn expected a non-empty list of variables to store. However, GnuR allows to do so.
Also fixed problem when using function "q()" in test cases which caused the test suite to crash due to an unexpected but legitimate exception.
parent 2dd6bdbf
No related branches found
No related tags found
No related merge requests found
......@@ -196,7 +196,7 @@ public class LoadSaveFunctions {
@Override
protected void createCasts(CastBuilder casts) {
casts.arg("list").mustBe(stringValue()).asStringVector().mustBe(notEmpty(), RError.Message.FIRST_ARGUMENT_NOT_CHARVEC).findFirst();
casts.arg("list").mustBe(stringValue()).asStringVector();
ConnectionFunctions.Casts.connection(casts);
casts.arg("ascii").mustBe(logicalValue(), RError.Message.ASCII_NOT_LOGICAL);
casts.arg("version").allowNull().mustBe(integerValue());
......
......@@ -41706,6 +41706,9 @@ $ix
[1] -Inf -Inf -Inf -Inf -Inf -Inf 0 1 2 3 4 5 Inf Inf Inf
[16] Inf Inf
 
##com.oracle.truffle.r.test.builtins.TestBuiltin_quit.testQuitEmptyEnv#
#{ quit("yes") }
##com.oracle.truffle.r.test.builtins.TestBuiltin_quit.testQuitErrorSave#
#{ quit("xx") }
Error in quit(save, status, runLast) : unrecognized value of 'save'
/*
* Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -32,4 +32,9 @@ public class TestBuiltin_quit extends TestBase {
public void testQuitErrorSave() {
assertEval("{ quit(\"xx\") }");
}
@Test
public void testQuitEmptyEnv() {
assertEval("{ quit(\"yes\") }");
}
}
......@@ -35,6 +35,7 @@ import com.oracle.truffle.api.debug.SuspendedCallback;
import com.oracle.truffle.api.debug.SuspendedEvent;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.vm.PolyglotEngine;
import com.oracle.truffle.r.runtime.ExitException;
import com.oracle.truffle.r.runtime.RCmdOptions;
import com.oracle.truffle.r.runtime.RCmdOptions.Client;
import com.oracle.truffle.r.runtime.RError;
......@@ -234,6 +235,8 @@ public final class FastRSession implements RSession {
}
} catch (ParseException e) {
e.report(consoleHandler);
} catch (ExitException e) {
// exit exceptions are legitimate if a test case calls "q()"
} catch (RError e) {
// nothing to do
} catch (Throwable t) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment