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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Jul 1 10:27:52 UTC 2009


Revision: 2562
          http://rkward.svn.sourceforge.net/rkward/?rev=2562&view=rev
Author:   tfry
Date:     2009-07-01 10:27:51 +0000 (Wed, 01 Jul 2009)

Log Message:
-----------
one more plugin test

Modified Paths:
--------------
    trunk/rkward/tests/import_export_plugins.R

Added Paths:
-----------
    trunk/rkward/tests/import_export_plugins/RKTestStandard.setworkdir.rkcommands.R

Added: trunk/rkward/tests/import_export_plugins/RKTestStandard.setworkdir.rkcommands.R
===================================================================
--- trunk/rkward/tests/import_export_plugins/RKTestStandard.setworkdir.rkcommands.R	                        (rev 0)
+++ trunk/rkward/tests/import_export_plugins/RKTestStandard.setworkdir.rkcommands.R	2009-07-01 10:27:51 UTC (rev 2562)
@@ -0,0 +1,16 @@
+local({
+## Prepare
+## Compute
+setwd("..")
+## Print result
+})
+.rk.rerun.plugin.link(plugin="rkward::setworkdir", settings="dir.selection=..", label="Run again")
+.rk.make.hr()
+local({
+## Prepare
+## Compute
+setwd("import_export_plugins")
+## Print result
+})
+.rk.rerun.plugin.link(plugin="rkward::setworkdir", settings="dir.selection=import_export_plugins", label="Run again")
+.rk.make.hr()

Modified: trunk/rkward/tests/import_export_plugins.R
===================================================================
--- trunk/rkward/tests/import_export_plugins.R	2009-06-30 19:50:14 UTC (rev 2561)
+++ trunk/rkward/tests/import_export_plugins.R	2009-07-01 10:27:51 UTC (rev 2562)
@@ -10,6 +10,8 @@
 	initCalls = list (
 		function () {
 			library ("R2HTML")
+			library ("datasets")
+			library ("foreign")
 		},
 		function () {
 			# prepare some different files for loading
@@ -38,7 +40,18 @@
 
 			# 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)
+		}, expect_error=TRUE),
+		new ("RKTest", id="setworkdir", call=function () {
+			oldwd <- getwd ()
+			on.exit (setwd (oldwd))
+
+			# we can only use relative paths, here, to make sure the tests produce identical commands on all systems
+			rk.call.plugin ("rkward::setworkdir", dir.selection="..", submit.mode="submit")
+			stopifnot (oldwd != getwd ())
+
+			rk.call.plugin ("rkward::setworkdir", dir.selection="import_export_plugins", submit.mode="submit")
+			stopifnot (oldwd == getwd ())
+		})
 	), postCalls = list ()	# like initCalls: run after all tests to clean up. Empty in this case.
 )
 


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