App-NDTools

 view release on metacpan or  search on metacpan

lib/App/NDTools/NDTool.pm  view on Meta::CPAN


    log_trace { ref $uri ? "Reading from STDIN" : "Loading '$uri'" };
    s_load($uri, $fmt);
}

sub new {
    my $self = bless {}, shift;

    $self->{OPTS} = $self->defaults();
    $self->{ARGV} =
        [ map { decode(locale => "$_", Encode::FB_CROAK) } @_ ? @_ : @ARGV ];

    $self->{TTY} = -t STDOUT;

    unless (GetOptionsFromArray ($self->{ARGV}, $self->arg_opts)) {
        $self->usage;
        die_fatal "Unsupported opts used", 1;
    }

    if ($self->{OPTS}->{help}) {
        $self->usage;

t/bin/nddiff.t  view on Meta::CPAN


$test = "term_grep_absent_part";
run_ok(
    name => $test,
    cmd => [ @cmd, '--grep', '[1]{Edit}[5]{id}', "_menu.a.json", "_menu.b.json" ],
    stdout => sub { file_contents_eq_or_diff("$test.exp", shift, $test) },
    exit => 8,
);

SKIP: {
    skip "non utf8 locale", 1 unless (exists $ENV{LC_ALL} and $ENV{LC_ALL} =~ /UTF-8/);

    $test = "term_grep_utf8_path";
    run_ok(
        name => $test,
        cmd => [ @cmd, '--grep', '{"текст"}', "_text-utf8.a.json", "_text-utf8.b.json" ],
        stdout => sub { file_contents_eq_or_diff("$test.exp", shift, $test, { encoding => 'UTF-8' }) },
        exit => 8,
    );
}

t/bin/ndquery.t  view on Meta::CPAN

);

$test = "path_3";
run_ok(
    name => $test,
    cmd => [ @cmd, '--path', '[1]{Edit}[](not defined)', "_menu.a.json" ],
    stdout => sub { file_contents_eq_or_diff("$test.exp", shift, $test) },
);

SKIP: {
    skip "non utf8 locale", 1 unless (exists $ENV{LC_ALL} and $ENV{LC_ALL} =~ /UTF-8/);

    $test = "path_utf8";
    run_ok(
        name => $test,
        cmd => [ @cmd, '--path', '{"текст"}', "_text-utf8.a.json" ],
        stdout => sub { file_contents_eq_or_diff("$test.exp", shift, $test, { encoding => 'UTF-8' }) },
    );
}

$test = "ofmt_yaml";



( run in 0.821 second using v1.01-cache-2.11-cpan-ceb78f64989 )