App-RecordStream

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    - Support -M and -m, a la perl itself, for operations that accept snippets
      (Thomas Sibley)

    - Lexically sort keys if no order is specified for a better user experience
      and passing tests on 5.18 (Eli Lindsey)

    - totable now respects explicit key ordering (Ben Bernard)

    - Handle input streams as bytes instead of assuming UTF-8 (Shawn Halpenny)

    - New and updated documentation for many operations

    - Fix various --help-* options to recs-collate, recs-join, recs-multiplex
      (Keith Amling, Ben Bernard, Thomas Sibley)

    - Fix normalize time issues with newer Date::Manip versions (Ben Bernard)

    - Require Text::CSV_XS 0.98 to avoid a bug with embedded newlines (Thomas
      Sibley)

    - Exec recs-chain with the same perl running the tests [rt.cpan.org #76879]

tests/RecordStream/Operation/fromatomfeed.t  view on Meta::CPAN

use Test::More;
use App::RecordStream::Test::OperationHelper 'fromatomfeed';
use App::RecordStream::Test::Tester;

my $output1 = <<OUTPUT;
{"dc:creator":"author1","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry1","author":{"name":"author1"},"title":"Entry 1"}
OUTPUT

my $output2 = <<OUTPUT;
{"dc:creator":"author1","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry1","author":{"name":"author1"},"title":"Entry 1"}
{"dc:creator":"author2","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry2","author":{"name":"author2"},"title":"Entry 2"}
OUTPUT

my $output3 = <<OUTPUT;
{"dc:creator":"author1","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry1","author":{"name":"author1"},"title":"Entry 1"}
{"dc:creator":"author2","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry2","author":{"name":"author2"},"title":"Entry 2"}
{"dc:creator":"author3","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry1","author":{"name":"author3"},"title":"Entry 3"}
OUTPUT

my $output4 = <<OUTPUT;
{"dc:creator":"author1","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry1","author":{"name":"author1"},"title":"Entry 1"}
{"dc:creator":"author2","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry2","author":{"name":"author2"},"title":"Entry 2"}
{"dc:creator":"author3","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry1","author":{"name":"author3"},"title":"Entry 3"}
{"dc:creator":"author4","updated":"2007-06-06T07:00:00Z","id":"http://localhost/entry4","author":{"name":"author4"},"title":"Entry 4"}
OUTPUT

my $tester = App::RecordStream::Test::Tester->new('fromatomfeed');
$tester->no_input_test([                            'file:tests/files/testFeed1'], $output4);
$tester->no_input_test([              '--nofollow', 'file:tests/files/testFeed1'], $output2);
$tester->no_input_test(['--max', '1',               'file:tests/files/testFeed1'], $output1);
$tester->no_input_test(['--max', '1', '--nofollow', 'file:tests/files/testFeed1'], $output1);
$tester->no_input_test(['--max', '2',               'file:tests/files/testFeed1'], $output2);
$tester->no_input_test(['--max', '3',               'file:tests/files/testFeed1'], $output3);
$tester->no_input_test(['--max', '3', '--nofollow', 'file:tests/files/testFeed1'], $output2);

tests/files/testFeed1  view on Meta::CPAN

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:georss="http://www.georss.org/georss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:sl...
  <title>Test Feed 1</title>
  <link rel="next" href="file:tests/files/testFeed2" />
  <id>file:testFeed1</id>
  <updated>2007-12-04T22:49:19Z</updated>
  <dc:creator>RecordStream</dc:creator>
  <dc:date>2007-12-04T22:49:19Z</dc:date>
  <entry>
    <title>Entry 1</title>
    <author>
      <name>author1</name>
    </author>
    <id>http://localhost/entry1</id>
    <updated>2007-06-06T07:00:00Z</updated>
    <dc:creator>author1</dc:creator>
  </entry>
  <entry>
    <title>Entry 2</title>
    <author>
      <name>author2</name>
    </author>
    <id>http://localhost/entry2</id>
    <updated>2007-06-06T07:00:00Z</updated>
    <dc:creator>author2</dc:creator>
  </entry>
</feed>

tests/files/testFeed2  view on Meta::CPAN

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:georss="http://www.georss.org/georss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:sl...
  <title>Test Feed - 2</title>
  <id>file:testFeed2</id>
  <updated>2007-12-04T22:49:19Z</updated>
  <dc:creator>RecordStream</dc:creator>
  <dc:date>2007-12-04T22:49:19Z</dc:date>
  <entry>
    <title>Entry 3</title>
    <author>
      <name>author3</name>
    </author>
    <id>http://localhost/entry1</id>
    <updated>2007-06-06T07:00:00Z</updated>
    <dc:creator>author3</dc:creator>
  </entry>
  <entry>
    <title>Entry 4</title>
    <author>
      <name>author4</name>
    </author>
    <id>http://localhost/entry4</id>
    <updated>2007-06-06T07:00:00Z</updated>
    <dc:creator>author4</dc:creator>
  </entry>
</feed>



( run in 0.346 second using v1.01-cache-2.11-cpan-05444aca049 )