App-RecordStream
view release on metacpan or search on metacpan
tests/RecordStream/InputStream.t view on Meta::CPAN
is_deeply($magic_stream->get_record(), $hash, 'Magic input');
is_deeply($magic_stream->get_record(), $hash, 'Magic input');
is_deeply($magic_stream->get_record(), undef, 'Magic input Ends');
@ARGV = @old_argv;
my $empty_fh = IO::String->new('');
ok(my $empty_stream = App::RecordStream::InputStream->new(FH => $empty_fh), "Empty String Initialize");
is_deeply($empty_stream->get_record(), undef, 'Empty String stream ends');
{
my $key = "foo\x{263A}"; # \x{263A} - unicode white smiley
my $value = "bar\x{263A}";
my $handle = IO::String->new(qq({"$key":"$value"}));
my $stream = App::RecordStream::InputStream->new(FH => $handle);
is_deeply($stream->get_record(), { $key => $value },
'InputStream handles key+values with wide characters');
}
tests/RecordStream/OutputStream.t view on Meta::CPAN
use Test::More qw(no_plan);
use IO::String;
use Data::Dumper;
BEGIN { use_ok( 'App::RecordStream::OutputStream' ) };
use IO::String;
use App::RecordStream::Record;
use App::RecordStream::InputStream;
my $unicode = "\x{263A}"; # \x{263A} - unicode white smiley
my $rec = App::RecordStream::Record->new(
'foo' => 'bar',
'zoo' => {
'blah' => 'biz',
'far' => [ 'fing', 'fang', 'foom' ],
"key-$unicode" => "value-$unicode",
}
);
my $output_string = App::RecordStream::OutputStream::hashref_string($rec);
my $in = App::RecordStream::InputStream->new(STRING => $output_string);
is_deeply($in->get_record(), $rec, 'got the same thing out as was put in');
( run in 0.635 second using v1.01-cache-2.11-cpan-88abd93f124 )