11
use constant CONFIG_OPTIONS => 98;
5
use constant CONFIG_OPTIONS => 115;
13
7
# Move of Debug to Run Menu
14
use Test::More tests => CONFIG_OPTIONS * 2 + 17;
8
use Test::More tests => CONFIG_OPTIONS * 2 + 21;
15
9
use Test::NoWarnings;
16
10
use File::Spec::Functions ':ALL';
22
16
use Padre::Constant ();
23
17
use Padre::Config ();
19
# Loading the configuration subsystem should NOT result in loading Wx
20
is( $Wx::VERSION, undef, 'Wx was not loaded during config load' );
25
22
# Create the empty config file
26
23
my $empty = Padre::Constant::CONFIG_HUMAN;
27
open( FILE, '>', $empty ) or die "Failed to open $empty";
28
print FILE "--- {}\n";
24
open( my $FILE, '>', $empty ) or die "Failed to open $empty";
25
print $FILE "--- {}\n";
32
29
my $config = Padre::Config->read;
37
34
is( $config->host->version, undef, '->host->version is undef' );
38
35
is( $config->human->version, undef, '->human->version is undef' );
37
# Loading the config file should not result in Wx loading
38
is( $Wx::VERSION, undef, 'Wx was not loaded during config read' );
40
40
# Check that the defaults work
42
42
sort { length($a) <=> length($b) or $a cmp $b } keys %Padre::Config::SETTING;
52
52
# The config version number is a requirement for every config and
53
53
# the only key which is allowed to live in an empty config.
54
my %Test_Config = ( Version => $Padre::Config::VERSION );
54
my %test_config = ( Version => $Padre::Config::VERSION );
56
56
# ... and that they don't leave a permanent state.
58
+{ %{ $config->human } }, \%Test_Config,
58
+{ %{ $config->human } }, \%test_config,
59
59
'Defaults do not leave permanent state (human)',
62
+{ %{ $config->host } }, \%Test_Config,
62
+{ %{ $config->host } }, \%test_config,
63
63
'Defaults do not leave permanent state (host)',
66
66
# Store the config again
67
67
ok( $config->write, '->write ok' );
69
# Saving the config file should not result in Wx loading
70
is( $Wx::VERSION, undef, 'Wx was not loaded during config write' );
69
72
# Check that we have a version for the parts now
70
73
is( $config->host->version, 1, '->host->version is set' );
71
74
is( $config->human->version, 1, '->human->version is set' );
87
90
# Confirm the config is round-trip safe
88
91
is_deeply( $config2, $config, 'Config round-trips ok' );
93
# No configuration operations require loading Wx
94
is( $Wx::VERSION, undef, 'Wx is never loaded during config operations' );