File: configfile.t

package info (click to toggle)
libmessage-passing-perl 0.117-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 544 kB
  • sloc: perl: 2,742; makefile: 2; sh: 1
file content (37 lines) | stat: -rw-r--r-- 663 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use strict;
use warnings;

use Test::More 0.88;
use File::Temp qw/ tempdir /;
use JSON::MaybeXS qw/ encode_json decode_json /;
use File::Spec;

my $dir = tempdir( CLEANUP => 1 );
my $path = File::Spec->catfile($dir, 'config.json');
open(my $fh, '>', $path)
    or die $!;
print $fh encode_json({
    input => 'Null',
    output => 'Test',
    input_options => {
        foo => 'bar',
    },
});
close($fh);

use_ok 'Message::Passing';

my $i;
{
    local @ARGV = ('--configfile', $path);
    $i = Message::Passing->new_with_options;
}

ok $i;
is $i->input, 'Null';
is $i->output, 'Test';
is_deeply $i->input_options, {
        foo => 'bar',
    };

done_testing;