[education/rkward] rkward: Fix wrong assignment in RK.Output class
Thomas Friedrichsmeier
null at kde.org
Sun Oct 2 17:27:37 BST 2022
Git commit 6e9b9d395bcfd57751e491b0730741c63669717c by Thomas Friedrichsmeier.
Committed on 02/10/2022 at 16:27.
Pushed by tfry into branch 'master'.
Fix wrong assignment in RK.Output class
M +22 -22 rkward/autotests/core_test.cpp
M +1 -1 rkward/rbackend/rpackages/rkward/R/rk.output.R
https://invent.kde.org/education/rkward/commit/6e9b9d395bcfd57751e491b0730741c63669717c
diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index 2863f4b4..7d5d1057 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -209,6 +209,28 @@ private slots:
cleanGlobalenv();
}
+ void restartRBackend() {
+ auto restart_action = RKWardMainWindow::getMain()->actionCollection()->action("restart_r");
+ QVERIFY(restart_action != nullptr);
+ RInterface::issueCommand(new RCommand("x <- 1", RCommand::User));
+ waitForAllFinished();
+ QVERIFY(RObjectList::getGlobalEnv()->findObject("x"));
+
+ auto oldiface = RInterface::instance();
+ restart_action->trigger();
+ while (RInterface::instance() == oldiface) { // action may be delayed until next event processing
+ qApp->processEvents();
+ }
+ waitForBackendStarted();
+
+ // backend should be clean after restart
+ QVERIFY(!RObjectList::getGlobalEnv()->findObject("x"));
+ // but of course it should also be functional...
+ RInterface::issueCommand(new RCommand("x <- 1", RCommand::User));
+ waitForAllFinished();
+ QVERIFY(RObjectList::getGlobalEnv()->findObject("x"));
+ }
+
void priorityCommandTest() {
bool priority_command_done = false;
runCommandAsync(new RCommand("Sys.sleep(5)", RCommand::User), nullptr, [&priority_command_done](RCommand *command) {
@@ -281,28 +303,6 @@ private slots:
testLog("%d out of %d commands were actually cancelled", cancelled_commands, commands_out);
}
- void restartRBackend() {
- auto restart_action = RKWardMainWindow::getMain()->actionCollection()->action("restart_r");
- QVERIFY(restart_action != nullptr);
- RInterface::issueCommand(new RCommand("x <- 1", RCommand::User));
- waitForAllFinished();
- QVERIFY(RObjectList::getGlobalEnv()->findObject("x"));
-
- auto oldiface = RInterface::instance();
- restart_action->trigger();
- while (RInterface::instance() == oldiface) { // action may be delayed until next event processing
- qApp->processEvents();
- }
- waitForBackendStarted();
-
- // backend should be clean after restart
- QVERIFY(!RObjectList::getGlobalEnv()->findObject("x"));
- // but of course it should also be functional...
- RInterface::issueCommand(new RCommand("x <- 1", RCommand::User));
- waitForAllFinished();
- QVERIFY(RObjectList::getGlobalEnv()->findObject("x"));
- }
-
void cleanupTestCase()
{
// at least the backend should exit properly, to avoid creating emergency save files
diff --git a/rkward/rbackend/rpackages/rkward/R/rk.output.R b/rkward/rbackend/rpackages/rkward/R/rk.output.R
index e5985141..8aad3d81 100644
--- a/rkward/rbackend/rpackages/rkward/R/rk.output.R
+++ b/rkward/rbackend/rpackages/rkward/R/rk.output.R
@@ -92,7 +92,7 @@ if and only if there are unsaved changes pending."
close=function(discard=NULL) {
"Forget about this output file, also closing any open views. Note: Trying to call any further methods on this object will fail."
.rk.do.call("output", c ("close", .checkId(), if(is.null(discard)) "ask" else if(isTRUE(discard)) "force" else "fail"))
- id<-NULL
+ id<<-character(0)
},
view=function(raise=TRUE) {
"Open this output for viewing in the frontend."
More information about the rkward-tracker
mailing list