#!/usr/bin/env perl
use warnings; use strict;
use Syntax::Keyword::Try;
-use lib "system/modules";
+use lib::relative ('.','../system/modules');
require TestManager;
#
###
- # Test constances.
+ # Test constants.
###
$test->case("Test mutability.");
try{
$cnf->{'$IMMUTABLE'} = "change?";
- $test->failed('Variable should be a constance!');
+ $test->failed('Variable should be a constant!');
}catch{
$test->subcase('Passed test is constance.');
}
--- /dev/null
+#!/usr/bin/env perl
+use warnings; use strict;
+use Syntax::Keyword::Try;
+use lib::relative ('.','../system/modules');
+
+require CNFParser;
+require TestManager;
+my $test = TestManager -> new($0);
+my $cnf;
+try{
+
+ ###
+ # Test instance creation.
+ ###
+ die $test->failed() if not $cnf = CNFParser->new(undef,{MyConstant=>"Can't be changed!"});
+ $test->case("Passed new instance CNFParser.",'1');
+ $test->subcase('CNFParser->VERSION is '.CNFParser->VERSION);
+ $test->subcase('Try changing an constant.');
+ try{
+ $cnf->{MyConstant} = "";
+ $test->failed("Constance must not be able to change!");
+ }catch{
+ $test->passed("Passed not can change!");
+ }
+ $test->subcase('Try finding an constant not existing');
+ try{
+ $cnf->{EXISTS} = "";
+ $test->failed("Constance exists how?");
+ }catch{
+ $test->passed("Passed constant EXISTS not has been made to exists!");
+ }
+
+
+ $test-> nextCase();
+ $test->case("Import Repository Methods",'2');
+ $cnf -> _import_into_this_package();
+ try{
+ my $val = const('MyConstant');
+ $test->isDefined('MyConstant',$val);
+ $test->evaluate('MyConstant',"Can't be changed!",$val);
+
+ }catch{
+ $test->failed("Failed to import methods");
+ }
+
+ #
+ $test->done();
+ #
+}
+catch{
+ $test -> dumpTermination($@);
+ $test -> doneFailed();
+}
#!/usr/bin/env perl
use warnings; use strict;
use Syntax::Keyword::Try;
-#no critic "eval"
-use lib "system/modules";
+
+use lib::relative ('.','../system/modules');
require CNFParser;
require TestManager;
my $test = TestManager -> new($0);
my $cnf;
+my $logfile = 'zzz_temp.log';
+
try{
###
# Test instance creation.
- #
- my $logfile = 'zzz_temp.log';
+ #
die $test->failed() if not $cnf = CNFParser->new(undef,{DO_ENABLED=>1,DEBUG=>1,'%LOG'=>{enabled=>1,file=>$logfile, tail=>10}});
- $test->case("Passed new instance CNFParser with log setings.");
+ $test->case("Passed new instance CNFParser with log settings.");
+ #`rm $logfile` if -f $logfile;
- $cnf->log("$_") for (1..20);
+ $cnf->log("$_") for (1..20);# Last log eleven tail cuts all previous log entries.
$cnf->parse(undef,'<<<test this>>>');
$test->evaluate('test == this', $cnf->anon('test'),'this');
#
$test->case("Has log only tail last 10 lines?");
open (my $fh, "<", $logfile) or die $!;
- my $cnt=11;
+ my $cnt=11;# <- should tail cut firs line to have 11.
while(my $line = <$fh>){
chomp($line);
$test -> evaluate("Log $line ends with $cnt?", $cnt, $line =~ m/(\d*)$/);
}
close $fh;
$test -> evaluate("Is ten lines tailed?", ($cnt-11), 10);
- `rm $logfile`;
+ `rm $logfile` if -f $logfile;
#
$test->done();
#
use Benchmark;
use File::stat;
-use lib "system/modules";
+use lib::relative ('.','../system/modules');
require TestManager;
require CNFParser;
my $cnf;
try{
- my $fstat = CNFParser::_fetchScriptStat($0);
+ my $fstat = CNF::_fetchScriptStat($0);
die $test->failed() if not $cnf = CNFParser->new( undef,
{DO_ENABLED=>1,'%LOG'=>{console=>1},TZ=>'Australia/Sydney', CNF_STAT => $fstat}
);
# $test -> nextCase();
# ####
-my $fstat = CNFParser::_fetchScriptStat($0);
+ my $fstat = CNF::_fetchScriptStat($0);
my $CNF_SCRIPT = qq{
#!/usr/bin/env perl
use warnings; use strict;
use Syntax::Keyword::Try;
-use lib "system/modules";
+use lib::relative ('.','../system/modules');
require TestManager;
-require CNFParser;
+require CNFParser; CNFParser::_import_into_this_package();
my $test = TestManager -> new($0);
-my $cnf;
-
-try{
- die $test->failed() if not my $cnf = CNFParser->new(undef,{'%LOG'=>{console=>1}});
+try{ #If STRICT is true parser will throw error, accessing from here.
+ die $test->failed() if not my $cnf = CNFParser->new(undef,{STRICT=>0,'%LOG'=>{console=>1}});
$test->case('Passed CNFParser->new().');
$test->case("Parse Typical Processor registration.");
my $processor = $cnf->registerProcessor("TestInstructor",'process');
$test->isDefined("\$processor", $processor);
- $test -> nextCase();
+ $test -> nextCase();
$test->case("Test parsing registration.");
$cnf->parse(undef,q(
<<TestInstructor<PROCESSOR>function:process>>
# my $plugin = $cnf->property('PROCESS_RSS_FEEDS');
# $test->failed() if not $plugin;
- # if(CNFParser::_isTrue($plugin->{CONVERT_TO_CNF_NODES})){
+ # if(CNF::_isTrue($plugin->{CONVERT_TO_CNF_NODES})){
# $test->subcase('Test data to CNF nodes tree conversion for RSS feeds.');
# my $perl_weekly = $cnf->getTree('Perl Weekly');
# $test->isDefined("Has tree 'Perl Weekly'?",$perl_weekly);
#!/usr/bin/env perl
-use 5.28.0;
-use warnings; use strict;
+use warnings;
+use strict;
+use feature "say";
use Syntax::Keyword::Try;
use Benchmark;
-use lib 'system/modules';
+use lib::relative ( '.', '../system/modules' );
require TestManager;
require CNFParser;
try{
- die $test->failed() if not $cnf = CNFParser->new(undef,{'%LOG'=>{console=>1}});
+die $test->failed()
+ if not $cnf =
+ CNFParser->new( undef, { STRICT => 0, '%LOG' => { console => 1 } } );
$test->case("Passed new instance CNFParser.");
$test->case("Test Obtaining localProjectConfigFile.");
print "Obtained path: $path\n";
$test->subcase("Test as projected path.");
- $path = CNFParser->new(undef,{PROJECT_NAME=>'MY_PROJECT'}) -> localProjectConfigFile();
+$path = CNFParser->new( undef, { STRICT => 0, PROJECT_NAME => 'MY_PROJECT' } )
+ ->localProjectConfigFile();
print "Obtained path: $path\n";
#
$test-> nextCase();
#
$test->case("Is DATA reserved word.");
- $test->isDefined("isReservedWord('DATA')",1,$cnf->isReservedWord("DATA"));
+ $test->evaluate("isReservedWord('DATA')",1,$cnf->isReservedWord("DATA"));
###
#
$test->done();