]> git.donarmstrong.com Git - deb_pkgs/libstatistics-r-perl.git/blob - t/08-errors.t
package new release
[deb_pkgs/libstatistics-r-perl.git] / t / 08-errors.t
1 #! perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6 use Statistics::R;
7
8
9 SKIP: {
10    skip 'because tests hang on Win32 (bug #81159)', 1 if $^O =~ /^(MS)?Win32$/;
11
12    ok my $R = Statistics::R->new(bin => '/foo/ba/R');
13    eval {
14       $R->run( qq`print("Hello");` );
15    };
16    #diag "Diagnostic: \n".$@."\n";
17    ok $@, 'Executable not found';
18
19    ok $R = Statistics::R->new();
20    is $R->run(q`a <- 1;`), '';
21
22    eval {
23       $R->run( qq`print("Hello");\nprint(ASDF)` );
24    };
25    #diag "Diagnostic: \n".$@."\n";
26    ok $@, 'Runtime error';
27
28    is $R->run(q`a <- 1;`), '';
29
30    ok $R = Statistics::R->new();
31    eval {
32       $R->run( qq`print("Hello");\nprint "ASDF"` );
33    };
34    #diag "Diagnostic: \n".$@."\n";
35    ok $@, 'Syntax error';
36    # Actual error message varies depending on locale
37
38    is $R->run(q`a <- 1;`), '';
39
40    use_ok 't::FlawedStatisticsR';
41    ok $R = t::FlawedStatisticsR->new();
42    eval {
43       $R->run( qq`print("Hello");\ncolors<-c("red")` );
44    };
45    #diag "Diagnostic: \n".$@."\n";
46    ok $@, 'Internal error';
47
48 };
49
50 done_testing;
51
52