]> lifelog.hopto.org Git - PerlCNFWEBServer.git/commitdiff
.
authorWill Budic <redacted>
Thu, 15 May 2025 08:54:02 +0000 (18:54 +1000)
committerWill Budic <redacted>
Thu, 15 May 2025 08:54:02 +0000 (18:54 +1000)
.gitignore
tests/template_for_new_test.pl [new file with mode: 0644]
tests/testAppConfigFile.cnf [new file with mode: 0644]
tests/testAppConfigFile.pl [new file with mode: 0644]

index 3e4abb59738bbece3eb5f3b34ebea3cd86f9009d..21f3a8dc9b7126c4bd4f715d6c3bd88b1b700a25 100644 (file)
@@ -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 (file)
index 0000000..3e5e440
--- /dev/null
@@ -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 (file)
index 0000000..382051e
--- /dev/null
@@ -0,0 +1,4 @@
+<<<CONST
+DEBUG = 1
+DO_ENABLED = 1
+>>>
\ No newline at end of file
diff --git a/tests/testAppConfigFile.pl b/tests/testAppConfigFile.pl
new file mode 100644 (file)
index 0000000..00905e6
--- /dev/null
@@ -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