aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/r/catches_strings_runme.R
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/r/catches_strings_runme.R')
-rw-r--r--Examples/test-suite/r/catches_strings_runme.R24
1 files changed, 24 insertions, 0 deletions
diff --git a/Examples/test-suite/r/catches_strings_runme.R b/Examples/test-suite/r/catches_strings_runme.R
new file mode 100644
index 000000000..db6783d91
--- /dev/null
+++ b/Examples/test-suite/r/catches_strings_runme.R
@@ -0,0 +1,24 @@
+clargs <- commandArgs(trailing=TRUE)
+source(file.path(clargs[1], "unittest.R"))
+
+dyn.load(paste("catches_strings", .Platform$dynlib.ext, sep=""))
+source("catches_strings.R")
+cacheMetaData(1)
+
+exception_thrown = FALSE
+tryCatch({
+ StringsThrower_charstring()
+}, error = function(e) {
+ exception_thrown <<- grepl(e$message, "charstring message", fixed=TRUE)
+}
+)
+unittest(exception_thrown, TRUE)
+
+exception_thrown = FALSE
+tryCatch({
+ StringsThrower_stdstring()
+}, error = function(e) {
+ exception_thrown <<- grepl(e$message, "stdstring message", fixed=TRUE)
+}
+)
+unittest(exception_thrown, TRUE)