Config-Model

 view release on metacpan or  search on metacpan

t/value.t  view on Meta::CPAN

use ExtUtils::testlib;
use Test::More;
use Test::Exception;
use Test::Differences;
use Test::Memory::Cycle;
use Config::Model;
use Config::Model::Tester::Setup qw/init_test/;
use Config::Model::Value;
use Test::Log::Log4perl;
use Path::Tiny 0.125; # for mkdir

use strict;
use warnings;

use 5.010;

binmode STDOUT, ':encoding(UTF-8)';

my $test_dir = path("wr_root/value");
$test_dir->mkdir;
my $ini_file = $test_dir->child('test.ini');
my $json_file = $test_dir->child('test.json');
my $yaml_file = $test_dir->child('test.yaml');
my $toml_file = $test_dir->child('test.toml');

my ($model, $trace) = init_test();

# override setup done in init_test()
Test::Log::Log4perl->ignore_priority("debug");

# minimal set up to get things working
$model->create_config_class(
    name    => "BadClass",
    element => [
        crooked => {
            type  => 'leaf',
            class => 'Config::Model::Value',
        },
        crooked_enum => {
            type       => 'leaf',
            class      => 'Config::Model::Value',
            value_type => 'enum',
            default    => 'foo',
            choice     => [qw/A B C/]
        },
    ] );

$model->create_config_class(
    name    => "Master",
    element => [
        scalar => {
            type       => 'leaf',
            class      => 'Config::Model::Value',
            value_type => 'integer',
            min        => 1,
            max        => 4,
        },
        string => {
            type       => 'leaf',
            class      => 'Config::Model::Value',
            value_type => 'string',
        },
        string_with_help => {
            type       => 'leaf',



( run in 0.653 second using v1.01-cache-2.11-cpan-39bf76dae61 )