1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 10:55:40 -04:00

Merge shlomif's beginning of tests

This commit is contained in:
Ryan Voots 2020-10-26 14:35:31 -07:00
parent 2bb104044c
commit f10008f7d1
3 changed files with 82 additions and 1 deletions

View file

@ -20,4 +20,4 @@ jobs:
run: |
apt update && apt -y install libprotobuf-dev libprotoc-dev
cpanm --installdeps --notest .
# prove
bin/run-tests

45
bin/run-tests Normal file
View file

@ -0,0 +1,45 @@
#! /usr/bin/env perl
#
# Author Shlomi Fish <shlomif@cpan.org>
# Version 0.0.1
#
use strict;
use warnings;
use autodie;
# We'd rather avoid exec() here because from our experience, it sometimes
# does not work too reliably on MSWin32.
exit( ( system( "prove", glob("t/*.t") ) == 0 ) ? 0 : 1 );
__END__
=head1 COPYRIGHT & LICENSE
Copyright 2019 by Shlomi Fish
This program is distributed under the MIT / Expat License:
L<http://www.opensource.org/licenses/mit-license.php>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
=cut

36
t/unicode-plugin.t Normal file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Test::More tests => 4;
use Test::Differences qw/ eq_or_diff /;
use lib '.';
use plugins::unicode;
sub check
{
local $Test::Builder::Level = $Test::Builder::Level + 1;
my ( $body, $want, $blurb ) = @_;
my ( $err, $out ) = unip( map speng($_), split " ", $body );
return eq_or_diff( $err, [], "no errors" )
&& eq_or_diff( $out, $want, $blurb );
}
# TEST*2
check(
"perl",
[
"U+0070 (70): LATIN SMALL LETTER P [p]",
"U+0065 (65): LATIN SMALL LETTER E [e]",
"U+0072 (72): LATIN SMALL LETTER R [r]",
"U+006C (6c): LATIN SMALL LETTER L [l]",
],
"ascii"
);
# TEST*2
check( "💟", [ "U+1F49F (f0 9f 92 9f): HEART DECORATION [💟]", ],
"emoji", );