Parse-ANSIColor-Tiny

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      "test" : {
         "recommends" : {
            "CPAN::Meta" : "2.120900"
         },
         "requires" : {
            "ExtUtils::MakeMaker" : "0",
            "File::Spec" : "0",
            "File::Temp" : "0",
            "IO::Handle" : "0",
            "IPC::Open3" : "0",
            "Test::Differences" : "0",
            "Test::More" : "0.96",
            "Test::Requires" : "0",
            "perl" : "5.006"
         }
      }
   },
   "provides" : {
      "Parse::ANSIColor::Tiny" : {
         "file" : "lib/Parse/ANSIColor/Tiny.pm",
         "version" : "0.700"

META.yml  view on Meta::CPAN

---
abstract: 'Determine attributes of ANSI-Colored string'
author:
  - 'Randy Stauner <rwstauner@cpan.org>'
build_requires:
  ExtUtils::MakeMaker: '0'
  File::Spec: '0'
  File::Temp: '0'
  IO::Handle: '0'
  IPC::Open3: '0'
  Test::Differences: '0'
  Test::More: '0.96'
  Test::Requires: '0'
  perl: '5.006'
configure_requires:
  ExtUtils::MakeMaker: '0'
  perl: '5.006'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:

Makefile.PL  view on Meta::CPAN

  "PREREQ_PM" => {
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0,
    "File::Spec" => 0,
    "File::Temp" => 0,
    "IO::Handle" => 0,
    "IPC::Open3" => 0,
    "Test::Differences" => 0,
    "Test::More" => "0.96",
    "Test::Requires" => 0
  },
  "VERSION" => "0.700",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "ExtUtils::MakeMaker" => 0,
  "File::Spec" => 0,
  "File::Temp" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "Test::Differences" => 0,
  "Test::More" => "0.96",
  "Test::Requires" => 0,
  "strict" => 0,
  "warnings" => 0
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};

t/00-report-prereqs.dd  view on Meta::CPAN

       'test' => {
                   'recommends' => {
                                     'CPAN::Meta' => '2.120900'
                                   },
                   'requires' => {
                                   'ExtUtils::MakeMaker' => '0',
                                   'File::Spec' => '0',
                                   'File::Temp' => '0',
                                   'IO::Handle' => '0',
                                   'IPC::Open3' => '0',
                                   'Test::Differences' => '0',
                                   'Test::More' => '0.96',
                                   'Test::Requires' => '0',
                                   'perl' => '5.006'
                                 }
                 }
     };
  $x;
 }

t/chart.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More tests => 4;
use Test::Differences;

# shortcuts
BEGIN {
  use Parse::ANSIColor::Tiny;
  sub o ($) { 'on_'     . $_[0] }
  sub b ($) { 'bright_' . $_[0] }
  sub bo () { 'bold' }
  eval join '', map { "sub $_ () { '$_' }" } keys %Parse::ANSIColor::Tiny::ATTRIBUTES;
}

t/chart_256.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More tests => 1 + 256 * 4 + 1;
use Test::Differences;
use Parse::ANSIColor::Tiny;

my $p = new_ok('Parse::ANSIColor::Tiny');

my $chart = do { local $/; <DATA>; };
my $parsed = $p->parse($chart);

sub expect {
  for my $prefix ( '', 'on_' ){
    my $name = $prefix . $_[0];

t/colors.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

my $mod = 'Parse::ANSIColor::Tiny';
eval "require $mod" or die $@;

my $p = new_ok($mod);

my @colors = qw( black red green yellow blue magenta cyan white );

my @colors256 = (
  (map { "ansi$_" } 0 .. 15),

t/encoding.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;
use Test::Requires 'Encode';
BEGIN { Encode->import(qw( encode decode is_utf8 )); }

my $mod = 'Parse::ANSIColor::Tiny';
eval "require $mod" or die $@;

my $p = new_ok($mod);

sub is_utf8_ok {
  my ($string, $exp, $desc) = @_;

t/exports.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

use Parse::ANSIColor::Tiny map { "${_}_ansicolor" } qw( identify normalize parse );

eq_or_diff
  [ identify_ansicolor(qw(1;31 104)) ],
  [ qw(bold red on_bright_blue) ],
  'identify_ansicolor exported and working';

eq_or_diff
  [ normalize_ansicolor(qw( bold blue clear red underline on_blue green )) ],

t/identify.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

my $mod = 'Parse::ANSIColor::Tiny';
eval "require $mod" or die $@;

my $p = new_ok($mod);

eq_or_diff [$p->identify('31')  ],           [qw(red)  ], 'simple color';
eq_or_diff [$p->identify('0032')],           [qw(green)], 'leading zeroes';
eq_or_diff [$p->identify('33;0')],           [qw(yellow clear)], 'color;clear';
eq_or_diff [$p->identify('0034;0035')],      [qw(blue magenta)], 'two zero-padded colors';

t/normalize.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

my $mod = 'Parse::ANSIColor::Tiny';
eval "require $mod" or die $@;

my $p = new_ok($mod);

eq_or_diff [$p->normalize(qw(red))],                         [qw(red)], 'simple fg color';
eq_or_diff [$p->normalize(qw(red green))],                   [qw(green)], 'overwrite fg color';
eq_or_diff [$p->normalize(qw(green red))],                   [qw(red)], 'overwrite fg color';
eq_or_diff [$p->normalize(qw(on_blue on_green))],            [qw(on_green)], 'overwrite bg color';

t/parse.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

my $mod = 'Parse::ANSIColor::Tiny';
eval "require $mod" or die $@;

sub e { note $_[0]; $_[0] }

my $p = new_ok($mod);

eq_or_diff
  $p->parse(e "foo\033[31mbar\033[00m"),

t/process.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

my $mod = 'Parse::ANSIColor::Tiny';
eval "require $mod" or die $@;

my $p = new_ok($mod);

# process() makes no changes if nothing is configured

eq_or_diff
  [$p->process(qw(red on_white reverse))],

t/process_reverse.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

my $mod = 'Parse::ANSIColor::Tiny';
eval "require $mod" or die $@;

sub e { note $_[0]; $_[0] }

my $p = new_ok($mod);

# simplify 'reverse' (regardless of auto_reverse option)

t/remove_escapes.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

my $mod = 'Parse::ANSIColor::Tiny';
eval "require $mod" or die $@;

my $p = new_ok($mod);

{
  chomp(my $other_escapes = <<ESC);
\033[1A\033[2KPhantomJS 1.9.7 (Linux): Executed 5 of 10\033[32m SUCCESS\033[39m (0 secs / 0.066 secs)\033[0m
ESC

t/term-ansicolor.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More 0.96;
use Test::Differences;

plan skip_all => 'Term::ANSIColor required for these tests'
  unless eval 'require Term::ANSIColor';

use Parse::ANSIColor::Tiny;
my $p = new_ok('Parse::ANSIColor::Tiny');

# in order to match exact output from colored()
# we need to end each chunk with a 'clear' (colored() always ends with a clear)
# plus attributes are not inherited across calls so we need to repeat them



( run in 1.463 second using v1.01-cache-2.11-cpan-5837b0d9d2c )