1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use lib 'lib';
7use Clipboard;
8my $CJ = 'perl -Ilib scripts/clipjoin';
9print "# Using $CJ and $INC{'Clipboard.pm'}\n";
10my %tests = (
11    "http://as\ndf.com" => 'http://asdf.com',
12    "http://as\n   |  df.com" => 'http://asdf.com',
13    "http://as\n+df.com" => 'http://asdf.com',
14    "A\n tall \nquote." => 'A tall quote.', # html-ish interpretation of space
15);
16for my $input (keys %tests) {
17    my $expected = $tests{$input};
18    Clipboard->copy($input);
19    system("$CJ -q") == 0 or die "$CJ failed: $!";
20    my $actual = Clipboard->paste;
21    if ($actual ne $expected) {
22        print "[$actual] != [$expected]\n";
23    } else {
24        print "$actual ok\n";
25    }
26}
27