From: Will Budic Date: Thu, 15 May 2025 08:54:02 +0000 (+1000) Subject: . X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=f80e2026ea98c0148c4e3f87d7c63454295913b9;p=PerlCNFWEBServer.git . --- diff --git a/.gitignore b/.gitignore index 3e4abb5..21f3a8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vscode system -wsrc \ No newline at end of file +wsrc +tests/testAppConfigFile.cnf diff --git a/tests/template_for_new_test.pl b/tests/template_for_new_test.pl new file mode 100644 index 0000000..3e5e440 --- /dev/null +++ b/tests/template_for_new_test.pl @@ -0,0 +1,51 @@ +#!/usr/bin/env perl +use warnings; use strict; +use Syntax::Keyword::Try; +#no critic "eval" + +### +# To debug in vscode you need the extension LanguageServer and Debuger by Gerald Richter +# the optional Perl Navigator uses also the LanguagerServer but isn't one. +# To debug in vs code the following local use lib ... have to be commented out. +# Do not forget to uncoment them when commiting or using outside of vscode. +# Setup settings.json now too. +# +# Here is LanguageServer settings example for settings.json +# requires full paths for Gerald's extension because it is dumb to reslove this. +# +# "perl.perlInc": [ +# "/home/will/dev_new/PerlCNF/tests", +# "/home/will/dev_new/PerlCNF/system/modules" +# ] +# After that disable all the followin use lib ... statements: +### +use lib "tests"; +use lib "local"; +use lib "system/modules"; + +require TestManager; +my $test = TestManager -> new($0); +my $cnf; + +try{ + ### + # Test instance creation. + # + die $test->failed() if not $cnf = CNFParser->new(); + $test->case("Passed new instance CNFParser."); + # + $test-> nextCase(); + # + + # + $test->done(); + # +} +catch{ + $test -> dumpTermination($@); + $test -> doneFailed(); +} + +# +# TESTING ANY POSSIBLE SUBS ARE FOLLOWING FROM HERE # +# \ No newline at end of file diff --git a/tests/testAppConfigFile.cnf b/tests/testAppConfigFile.cnf new file mode 100644 index 0000000..382051e --- /dev/null +++ b/tests/testAppConfigFile.cnf @@ -0,0 +1,4 @@ +<<>> \ No newline at end of file diff --git a/tests/testAppConfigFile.pl b/tests/testAppConfigFile.pl new file mode 100644 index 0000000..00905e6 --- /dev/null +++ b/tests/testAppConfigFile.pl @@ -0,0 +1,59 @@ +#!/usr/bin/env perl +use warnings; use strict; +use Syntax::Keyword::Try; +#no critic "eval" + +### +# To debug in vscode you need the extension LanguageServer and Debugger by Gerald Richter +# the optional Perl Navigator uses also the LanguagerServer but isn't one. +# To debug in vs code the following local use lib ... have to be commented out. +# Do not forget to uncoment them when committing or using outside of vscode. +# Setup settings.json now too. +# +# Here is LanguageServer settings example for settings.json +# requires full paths for Gerald's extension because it is dumb to resolve this. +# +# "perl.perlInc": [ +# "/home/will/dev_new/PerlCNF/tests", +# "/home/will/dev_new/PerlCNF/system/modules" +# ] +# After that disable all the followin use lib ... statements: +### +use lib "tests"; +use lib "/home/will/dev_new/PerlCNFWEBServer"; +use lib "/home/will/dev_new/PerlCNFWEBServer/apps"; +use lib "/home/will/dev_new/PerlCNF/system/modules"; +use lib "/home/will/dev_new/PerlCNF/tests"; + +require TestManager; +require CNFParser; + +my $test = TestManager -> new($0); +my $cnf; + +try{ + ### + # Test instance creation. + # + die $test->failed() if not $cnf = CNFParser->new("apps/app.cnf",{DO_ENABLED => 1}); + $test->case("Passed new instance CNFParser."); + my $app = $cnf->anon('App'); + $test -> isDefined("App", $app); + my $list = $app -> node('header/meta')->list(); + $test -> evaluate("Has 4 list items?", 7 , scalar(@$list)); + # + $test-> nextCase(); + # + + # + $test->done(); + # +} +catch{ + $test -> dumpTermination($@); + $test -> doneFailed(); +} + +# +# TESTING ANY POSSIBLE SUBS ARE FOLLOWING FROM HERE # +# \ No newline at end of file