[rkward-cvs] [rkward] tests: added plugin test for CSV export

m.eik michalke meik.michalke at uni-duesseldorf.de
Thu Dec 4 14:52:49 UTC 2014


Git commit 6cc1349c8939d389e76fc2c301b9e9bcca5a1651 by m.eik michalke.
Committed on 04/12/2014 at 14:52.
Pushed by meikm into branch 'master'.

added plugin test for CSV export

M  +9    -0    tests/import_export_plugins.R
A  +15   -0    tests/import_export_plugins/write_csv.rkcommands.R
A  +38   -0    tests/import_export_plugins/write_csv.rkout

http://commits.kde.org/rkward/6cc1349c8939d389e76fc2c301b9e9bcca5a1651

diff --git a/tests/import_export_plugins.R b/tests/import_export_plugins.R
index 88cadab..7b9aba9 100644
--- a/tests/import_export_plugins.R
+++ b/tests/import_export_plugins.R
@@ -107,6 +107,15 @@ suite <- new ("RKTestSuite", id="import_export_plugins",
 			x <- readLines ("data")
 			for (line in x) rk.print (line)
 		}),
+    new ("RKTest", id="write_csv", call=function () {
+      assign ("women", datasets::women, globalenv())
+      rk.sync.global()
+
+      rk.call.plugin ("rkward::save_csv", dec.string=".", encoding.string="", eol.string="\\n", file.selection="data", na.text="NA", qmethod.string="double", quick.string="csv", quote.state="1", rowname.string="TRUE", sep.string=",", x.available="women", submit.mode="submit")
+
+      x <- readLines ("data")
+      for (line in x) rk.print (line)
+    }),
 		new ("RKTest", id="package_skeleton", call=function () {
 			# create two functions to use
 			assign ("skel.func1", rkwardtests::rktest.getTempDir, envir=globalenv())
diff --git a/tests/import_export_plugins/write_csv.rkcommands.R b/tests/import_export_plugins/write_csv.rkcommands.R
new file mode 100644
index 0000000..a6c4d11
--- /dev/null
+++ b/tests/import_export_plugins/write_csv.rkcommands.R
@@ -0,0 +1,15 @@
+local({
+## Berechne
+
+	# some options can't be changed with write.csv() and are set to these values:
+	# append=FALSE, sep=",", dec=".", col.names=NA, qmethod="double"
+	write.csv(
+		x=women,
+		file="data",
+		fileEncoding=""
+	)
+
+## Drucke Ergebnisse
+rk.header ("Export Table / CSV files", parameters=list("File"="data",
+	"Data"="women"))
+})
diff --git a/tests/import_export_plugins/write_csv.rkout b/tests/import_export_plugins/write_csv.rkout
new file mode 100644
index 0000000..8e5cce9
--- /dev/null
+++ b/tests/import_export_plugins/write_csv.rkout
@@ -0,0 +1,38 @@
+<h1>Export Table / CSV files</h1>
+<h2>Parameters</h2>
+<ul><li>File: data</li>
+<li>Data: women</li>
+</ul>
+DATE<br />
+
+<p class='character'>"","height","weight"</p>
+
+<p class='character'>"1",58,115</p>
+
+<p class='character'>"2",59,117</p>
+
+<p class='character'>"3",60,120</p>
+
+<p class='character'>"4",61,123</p>
+
+<p class='character'>"5",62,126</p>
+
+<p class='character'>"6",63,129</p>
+
+<p class='character'>"7",64,132</p>
+
+<p class='character'>"8",65,135</p>
+
+<p class='character'>"9",66,139</p>
+
+<p class='character'>"10",67,142</p>
+
+<p class='character'>"11",68,146</p>
+
+<p class='character'>"12",69,150</p>
+
+<p class='character'>"13",70,154</p>
+
+<p class='character'>"14",71,159</p>
+
+<p class='character'>"15",72,164</p>





More information about the rkward-tracker mailing list