]> git.donarmstrong.com Git - deb_pkgs/libstatistics-r-perl.git/blobdiff - t/08-errors.t
New upstream version 0.34
[deb_pkgs/libstatistics-r-perl.git] / t / 08-errors.t
index 04b4a0ccb9fe52ca91567083abf1df52cfe28bad..a92ca4d7317a106ccc6066c4bcafa4c047899d88 100644 (file)
@@ -5,22 +5,48 @@ use warnings;
 use Test::More;
 use Statistics::R;
 
-plan tests => 3;
 
-my $R;
+SKIP: {
+   skip 'because tests hang on Win32 (bug #81159)', 1 if $^O =~ /^(MS)?Win32$/;
+
+   ok my $R = Statistics::R->new(bin => '/foo/ba/R');
+   eval {
+      $R->run( qq`print("Hello");` );
+   };
+   #diag "Diagnostic: \n".$@."\n";
+   ok $@, 'Executable not found';
+
+   ok $R = Statistics::R->new();
+   is $R->run(q`a <- 1;`), '';
+
+   eval {
+      $R->run( qq`print("Hello");\nprint(ASDF)` );
+   };
+   #diag "Diagnostic: \n".$@."\n";
+   ok $@, 'Runtime error';
+
+   is $R->run(q`a <- 1;`), '';
+
+   ok $R = Statistics::R->new();
+   eval {
+      $R->run( qq`print("Hello");\nprint "ASDF"` );
+   };
+   #diag "Diagnostic: \n".$@."\n";
+   ok $@, 'Syntax error';
+   # Actual error message varies depending on locale
+
+   is $R->run(q`a <- 1;`), '';
+
+   use_ok 't::FlawedStatisticsR';
+   ok $R = t::FlawedStatisticsR->new();
+   eval {
+      $R->run( qq`print("Hello");\ncolors<-c("red")` );
+   };
+   #diag "Diagnostic: \n".$@."\n";
+   ok $@, 'Internal error';
 
-ok $R = Statistics::R->new();
-
-
-eval {
-   $R->run( q`print "ASDF"` );
 };
-ok $@, 'Syntax error';
-# Actual error message vary depending on locale
 
+done_testing;
 
-eval {
-   $R->run( q`print(ASDF)` );
-};
-ok $@, 'Runtime error';