[education/rkward] rkward/autotests: Add unit test for the recently fixed crash.

Thomas Friedrichsmeier null at kde.org
Sat Oct 29 12:36:49 BST 2022


Git commit a55199e5fc37cd894312cf574e08fe78f7c2b24a by Thomas Friedrichsmeier.
Committed on 29/10/2022 at 11:36.
Pushed by tfry into branch 'master'.

Add unit test for the recently fixed crash.

M  +23   -0    rkward/autotests/core_test.cpp

https://invent.kde.org/education/rkward/commit/a55199e5fc37cd894312cf574e08fe78f7c2b24a

diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index 0fb23c68..2f5e386e 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -192,6 +192,29 @@ private slots:
 		RInterface::whenAllFinished(this, [](RCommand*) {
 			QCOMPARE(RObjectList::getGlobalEnv()->numChildren(), 0);
 		});
+
+		bool lock = true;
+		runCommandWithTimeout(new RCommand("dx <- data.frame(a=1:2, b=3:4)", RCommand::User), nullptr, [this, &lock](RCommand *command) {
+			auto dx = RObjectList::getGlobalEnv()->findObject("dx");
+			QVERIFY(dx != nullptr);
+			QVERIFY(dx->isContainer());
+			if (dx && dx->isContainer()) {
+			    auto dx_a = static_cast<RContainerObject*>(dx)->findChildByName("a");
+			    QVERIFY(dx_a != nullptr);
+			    if (dx_a) {
+				dx_a->rename("c");
+			    }
+			    dx->rename("dy");
+			}
+			auto c = new RCommand("dy$c", RCommand::GetIntVector);
+			runCommandWithTimeout(c, nullptr, [](RCommand *command) {
+			    QCOMPARE(command->getDataType(), RData::IntVector);
+			    QCOMPARE(command->getDataLength(), 2);
+			    QCOMPARE(command->intVector().value(1), 2);
+			});
+			lock = false;
+		});
+		while(lock) qApp->processEvents();
 	}
 
 	void parseErrorTest() {


More information about the rkward-tracker mailing list