-
-
Save anonymous/6b244812c41ed39850c06b5b332f22a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test; | |
plan 4; | |
EVAL('my $format="ini"; my $file = "t/test.ini";'~slurp('t/basetest.plt')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Config::Simple; | |
{ | |
my $conf; | |
$conf = Config::Simple.read($file) if $format eq ''; | |
$conf = Config::Simple.read($file, :f($format)) if $format ne ''; | |
ok $conf<video><title> eq "Dune", "Video title is Dune"; | |
ok $conf<subtitle><file> eq "Dune_sub.txt", "Subtitle file is Dune_sub.txt"; | |
nok $conf<dont><exist>.defined, "Calling something that don't exist"; | |
$conf<subtitle><format> = "ssa"; | |
$conf.write('t/temp.temp'); | |
$conf = Config::Simple.read("t/temp.temp") if $format eq ''; | |
$conf = Config::Simple.read("t/temp.temp", :f($format)) if $format ne ''; | |
ok $conf<subtitle><format> eq "ssa"; | |
unlink 't/temp.temp'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
our sub dumpfile (%what, $where) { | |
my $fh = open($where, :w); # Line 24 | |
$fh.print(dump(%what)); | |
$fh.close; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
method write($filename = Any) { | |
$.filename = $filename if $filename.defined; | |
Config::INI::Writer::dumpfile(%!hash, $.filename); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cannot invoke this object (REPR: Null; VMNull) | |
in sub dumpfile at /home/skarsnik/.rakudobrew/moar-nom/install/share/perl6/site/so24urces/128F70BAF7EE37E7F577EB56A42975DC38D67D29 (Config::INI::Writer) line 24 | |
in method write at /home/skarsnik/devel/perl6-config-simple/lib/Config/Simple/ini.pm6 (Config::Simple::ini) line 15 | |
in block <unit> at EVAL_0 line 12 | |
in block <unit> at t/02_ini.t line 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment