X-Git-Url: https://git.donarmstrong.com/?p=deb_pkgs%2Flibstatistics-r-perl.git;a=blobdiff_plain;f=t%2F06-get-set.t;fp=t%2F06-get-set.t;h=dc698deecdb854a8232bdda93202abec2eb79f02;hp=202bee13c5d8227ee477b62f4c04d83c14804b20;hb=5e71068076c23e49ee5655b94ea2c4b403790cbf;hpb=9d6b5f35bbae817f76a5099702e13836e5957d80 diff --git a/t/06-get-set.t b/t/06-get-set.t index 202bee1..dc698de 100644 --- a/t/06-get-set.t +++ b/t/06-get-set.t @@ -5,9 +5,6 @@ use warnings; use Test::More; use Statistics::R; -plan tests => 86; - - my ($R, $input, $output); @@ -95,5 +92,32 @@ is $$output[1], 2; is $$output[2], 3; +# Bug reported by Manuel A. Alonso Tarajano +is $R->run(q`mydat = seq(1:4)`), ''; +ok $output = $R->get('mydat'); +is $$output[0], 1; +is $$output[1], 2; +is $$output[2], 3; +is $$output[3], 4; + + +# Strings containing quotes and escaped quotes +$input = q{He said: "Let's go \"home\" now!\n"}; +ok $R->set('x', $input), 'string'; +ok $output = $R->get('x'); +is ref($output), ''; +is $output, q{He said: "Let's go \"home\" now!\n"}; + + +$input = q{He said: "Let's go \\\\\\\\\\\\\"home\\\\\\\\\\\\\" now!\n"}; +# because \ is a special char that needs to be escaped, this string really is: +# He said: "Let's go \\\\\\\"home\\\\\\\" now!\n +ok $R->set('x', $input), 'string'; +ok $output = $R->get('x'); +is ref($output), ''; +is $output, q{He said: "Let's go \\\\\\\\\\\\\"home\\\\\\\\\\\\\" now!\n"}; + + ok $R->stop(); +done_testing;