Skip to content

Instantly share code, notes, and snippets.

/02test.t Secret

Created August 9, 2016 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6b244812c41ed39850c06b5b332f22a1 to your computer and use it in GitHub Desktop.
Save anonymous/6b244812c41ed39850c06b5b332f22a1 to your computer and use it in GitHub Desktop.
use Test;
plan 4;
EVAL('my $format="ini"; my $file = "t/test.ini";'~slurp('t/basetest.plt'));
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';
}
our sub dumpfile (%what, $where) {
my $fh = open($where, :w); # Line 24
$fh.print(dump(%what));
$fh.close;
}
method write($filename = Any) {
$.filename = $filename if $filename.defined;
Config::INI::Writer::dumpfile(%!hash, $.filename);
}
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