Debian Codegraph @

at/clipjoin-test

raw
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use lib 'lib';
7 use Clipboard;
8 my $CJ = 'perl -Ilib scripts/clipjoin';
9 print "# Using $CJ and $INC{'Clipboard.pm'}\n";
10 my %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 );
16 for 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 }