[rkward-cvs] SF.net SVN: rkward:[2547] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Jun 24 17:18:54 UTC 2009


Revision: 2547
          http://rkward.svn.sourceforge.net/rkward/?rev=2547&view=rev
Author:   tfry
Date:     2009-06-24 17:18:54 +0000 (Wed, 24 Jun 2009)

Log Message:
-----------
Do not use .tar.gz to store the standards in SVN after all. Releases are compressed, anyway, and in the repository it just makes things harder to follow.
Add a few more tests.
Only look for overwrite-objects in globalenv()

Modified Paths:
--------------
    trunk/rkward/rkward/misc/rksaveobjectchooser.cpp
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
    trunk/rkward/tests/import_export_plugins.R
    trunk/rkward/tests/import_export_plugins.tar.gz
    trunk/rkward/tests/test.R

Added Paths:
-----------
    trunk/rkward/tests/import_export_plugins/
    trunk/rkward/tests/import_export_plugins/import_csv.rkcom.standard
    trunk/rkward/tests/import_export_plugins/import_csv.rkout.standard
    trunk/rkward/tests/import_export_plugins/import_csv.rkwarn.standard
    trunk/rkward/tests/import_export_plugins/import_csv_overwrite.rkcom.standard
    trunk/rkward/tests/import_export_plugins/import_csv_overwrite.rkwarn.standard
    trunk/rkward/tests/import_export_plugins/load_r_object.rkcom.standard
    trunk/rkward/tests/import_export_plugins/load_r_object.rkout.standard
    trunk/rkward/tests/import_export_plugins/load_r_object.rkwarn.standard

Modified: trunk/rkward/rkward/misc/rksaveobjectchooser.cpp
===================================================================
--- trunk/rkward/rkward/misc/rksaveobjectchooser.cpp	2009-06-24 16:29:09 UTC (rev 2546)
+++ trunk/rkward/rkward/misc/rksaveobjectchooser.cpp	2009-06-24 17:18:54 UTC (rev 2547)
@@ -2,7 +2,7 @@
                           rksaveobjectchooser  -  description
                              -------------------
     begin                : Mon Nov 27 2006
-    copyright            : (C) 2006, 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -79,8 +79,9 @@
 void RKSaveObjectChooser::nameEditChanged (const QString &) {
 	RK_TRACE (MISC);
 
-	RObject *object = RObjectList::getObjectList ()->findObject (validizedSelectedObjectName ());
+	RObject *object = RObjectList::getGlobalEnv ()->findObject (validizedSelectedObjectName ());
 	if (object) {
+qDebug ("exists: %s", qPrintable (object->getFullName ()));
 		object_exists = true;
 		overwrite_confirm->setText (i18n ("Overwrite? (The given object name already exists)"));
 		overwrite_confirm->setEnabled (true);

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2009-06-24 16:29:09 UTC (rev 2546)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2009-06-24 17:18:54 UTC (rev 2547)
@@ -90,11 +90,17 @@
 	}
 }
 
+# should this really be public?
 "rk.sync" <- function (x) {
 	object <- deparse (substitute (x))
 	.rk.do.call ("sync", object)
 }
 
+# should this really be public?
+"rk.sync.global" <- function () {
+	.rk.do.call("syncglobal", ls (envir=globalenv (), all.names=TRUE))
+}
+
 "rk.edit" <- function (x) {
 	object <- deparse (substitute (x))
 	.rk.do.call ("edit", object)

Added: trunk/rkward/tests/import_export_plugins/import_csv.rkcom.standard
===================================================================
--- trunk/rkward/tests/import_export_plugins/import_csv.rkcom.standard	                        (rev 0)
+++ trunk/rkward/tests/import_export_plugins/import_csv.rkcom.standard	2009-06-24 17:18:54 UTC (rev 2547)
@@ -0,0 +1,10 @@
+local({
+## Prepare
+## Compute
+women <<- read.csv (file="women.csv",  na.strings = "NA", nrows = -1, skip = 0, check.names = TRUE, strip.white = FALSE, blank.lines.skip = TRUE)
+## Print result
+rk.header("Import text / csv data", parameters=list("File", "women.csv",
+	"Import as", "women"))
+})
+.rk.rerun.plugin.link(plugin="rkward::import_csv", settings="allow_escapes.state=\nblanklinesskip.state=TRUE\ncheckname.state=TRUE\ncolclass.string=\ncolname.string=\ndec.string='.'\ndoedit.state=0\nfile.selection=women.csv\nflush.state=\nisrow.state=false\nna.text=NA\nname.selection=women\nnrows.text=-1\nquick.string=csv\nquote.string='\\\\\\\"'\nsep.string=','\nskip.text=0\nstrings_as_factors.string=\nstripwhite.state=FALSE", label="Run again")
+.rk.make.hr()

Added: trunk/rkward/tests/import_export_plugins/import_csv.rkout.standard
===================================================================
--- trunk/rkward/tests/import_export_plugins/import_csv.rkout.standard	                        (rev 0)
+++ trunk/rkward/tests/import_export_plugins/import_csv.rkout.standard	2009-06-24 17:18:54 UTC (rev 2547)
@@ -0,0 +1 @@
+<a href="rkward://runplugin/rkward::import_csv/allow_escapes.state=%0ablanklinesskip.state=TRUE%0acheckname.state=TRUE%0acolclass.string=%0acolname.string=%0adec.string='.'%0adoedit.state=0%0afile.selection=women.csv%0aflush.state=%0aisrow.state=false%0ana.text=NA%0aname.selection=women%0anrows.text=-1%0aquick.string=csv%0aquote.string='%5c%5c%5c%22'%0asep.string=','%0askip.text=0%0astrings_as_factors.string=%0astripwhite.state=FALSE">Run again</a><hr>

Added: trunk/rkward/tests/import_export_plugins/import_csv.rkwarn.standard
===================================================================
--- trunk/rkward/tests/import_export_plugins/import_csv.rkwarn.standard	                        (rev 0)
+++ trunk/rkward/tests/import_export_plugins/import_csv.rkwarn.standard	2009-06-24 17:18:54 UTC (rev 2547)
@@ -0,0 +1,2 @@
+Error in eval(expr, envir, enclos) : 
+  no function to return from, jumping to top level

Added: trunk/rkward/tests/import_export_plugins/import_csv_overwrite.rkwarn.standard
===================================================================
--- trunk/rkward/tests/import_export_plugins/import_csv_overwrite.rkwarn.standard	                        (rev 0)
+++ trunk/rkward/tests/import_export_plugins/import_csv_overwrite.rkwarn.standard	2009-06-24 17:18:54 UTC (rev 2547)
@@ -0,0 +1,3 @@
+Error in rk.call.plugin("rkward::import_csv", file.selection = "women.csv",  : 
+  
+The plugin could not be auto-submitted with these settings.

Added: trunk/rkward/tests/import_export_plugins/load_r_object.rkcom.standard
===================================================================
--- trunk/rkward/tests/import_export_plugins/load_r_object.rkcom.standard	                        (rev 0)
+++ trunk/rkward/tests/import_export_plugins/load_r_object.rkcom.standard	2009-06-24 17:18:54 UTC (rev 2547)
@@ -0,0 +1,10 @@
+local({
+## Prepare
+## Compute
+load (file="women.RData", envir=globalenv())
+## Print result
+rk.header("Load data", parameters=list("File", "women.RData",
+	"Import to environment", "globalenv()"))
+})
+.rk.rerun.plugin.link(plugin="rkward::load_r_object", settings="file.selection=women.RData\nother_env.state=0", label="Run again")
+.rk.make.hr()

Added: trunk/rkward/tests/import_export_plugins/load_r_object.rkout.standard
===================================================================
--- trunk/rkward/tests/import_export_plugins/load_r_object.rkout.standard	                        (rev 0)
+++ trunk/rkward/tests/import_export_plugins/load_r_object.rkout.standard	2009-06-24 17:18:54 UTC (rev 2547)
@@ -0,0 +1,7 @@
+<h1>Load data</h1>
+<h2>Parameters</h2>
+<ul><li>File: women.RData</li>
+<li>Import to environment: globalenv()</li>
+</ul>
+DATE<br>
+<a href="rkward://runplugin/rkward::load_r_object/file.selection=women.RData%0aother_env.state=0">Run again</a><hr>

Modified: trunk/rkward/tests/import_export_plugins.R
===================================================================
--- trunk/rkward/tests/import_export_plugins.R	2009-06-24 16:29:09 UTC (rev 2546)
+++ trunk/rkward/tests/import_export_plugins.R	2009-06-24 17:18:54 UTC (rev 2547)
@@ -21,17 +21,19 @@
 			rk.call.plugin ("rkward::load_r_object", file.selection="women.RData", other_env.state="0", submit.mode="submit")
 
 			stopifnot (all.equal (women, datasets::women))
-
-			# always clean up after the test!
-			suppressWarnings (rm ("women"))
 		}),
 		new ("RKTest", id="import_csv", call=function () {
-			rk.call.plugin ("rkward::import_csv", allow_escapes.state="", blanklinesskip.state="TRUE", checkname.state="TRUE", colclass.string="", colname.string="", dec.string="'.'", doedit.state="0", file.selection="women.csv", flush.state="", isrow.state="false", na.text="NA", name.selection="women", nrows.text="-1", quick.string="csv", quote.string="'\\\"'", sep.string="','", skip.text="0", strings_as_factors.string="", stripwhite.state="FALSE", submit.mode="auto")
+			rk.call.plugin ("rkward::import_csv", allow_escapes.state="", blanklinesskip.state="TRUE", checkname.state="TRUE", colclass.string="", colname.string="", dec.string="'.'", doedit.state="0", file.selection="women.csv", flush.state="", isrow.state="false", na.text="NA", name.selection="women", nrows.text="-1", quick.string="csv", quote.string="'\\\"'", sep.string="','", skip.text="0", strings_as_factors.string="", stripwhite.state="FALSE", submit.mode="submit")
 
 			stopifnot (all.equal (women, datasets::women))
+		}),
+		new ("RKTest", id="import_csv_overwrite", call=function () {
+			assign ("women", datasets::women, envir=globalenv ())
+			rk.sync.global ()
 
-			suppressWarnings (rm ("women"))
-		})
+			# this one is expected to fail, as it would overwrite the existing "women" in globalenv()
+			rk.call.plugin ("rkward::import_csv", file.selection="women.csv", name.selection="women", submit.mode="submit")
+		}, expect_error=TRUE)
 	), postCalls = list ()
 )
 

Modified: trunk/rkward/tests/import_export_plugins.tar.gz
===================================================================
(Binary files differ)

Modified: trunk/rkward/tests/test.R
===================================================================
--- trunk/rkward/tests/test.R	2009-06-24 16:29:09 UTC (rev 2546)
+++ trunk/rkward/tests/test.R	2009-06-24 17:18:54 UTC (rev 2547)
@@ -101,11 +101,21 @@
 	rk.record.commands (code_file)
 	on.exit (rk.record.commands (NULL), add=TRUE)
 
+	old.symbols <- ls (envir=globalenv (), all.names=TRUE)
+	on.exit ({
+			# clean up any new objects created by the test
+			new.symbols <- ls (envir=globalenv (), all.names=TRUE)
+			new.symbols <- new.symbols[!(new.symbols %in% old.symbols)]
+			rm (list=new.symbols, envir=globalenv ())
+			rk.sync.global ()
+		}, add=TRUE)
+
 	failed <- TRUE
 	try ({
 		test at call ()
 		failed <- FALSE
 	})
+
 	return (failed)
 }
 
@@ -155,7 +165,6 @@
 	# clean any old results
 	rktest.cleanRKTestSuite (suite, basedir)
 
-	system (paste ("tar -xzf", suite at id, ".tar.gz", sep=""))
 	oldwd = getwd ()
 	on.exit (setwd (oldwd))
 	setwd (paste (basedir, suite at id, sep="/"))
@@ -193,13 +202,8 @@
 
 	# clean anything that is *not* a standard file
 	rktest.cleanRKTestSuite (suite, basedir)
-
-	# create package
-	setwd (basedir)
-	system (paste ("tar -czf ", suite at id, ".tar.gz ", suite at id, sep=""))
 }
 
-
 # You can use this to temporarily replace .rk.rerun.plugin.link.
 # This way, after running a plugin, you are shown the call needed to run this
 # plugin with those settings, instead of the link.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list