]> lifelog.hopto.org Git - PerlCNF.git/commitdiff
Instructer further implemented.
authorWill Budic <redacted>
Tue, 18 Mar 2025 18:02:05 +0000 (05:02 +1100)
committerWill Budic <redacted>
Tue, 18 Mar 2025 18:02:05 +0000 (05:02 +1100)
tests/testInstructor.pl

index b98bb4ffeb34856a51bae654646c7bb1c9d99dc7..6e61358332d9ad786ce3ae39a7212f075448f60d 100644 (file)
@@ -26,23 +26,48 @@ try{
         $cnf->parse(undef,q(
             <<TestInstructor<INSTRUCTOR>TEST2>>
         ));
-     $test -> nextCase();        
+           
         
         try{
-            # New instance doesn't mask it for being global, it is still there!
-            CNFParser->new(undef,{STRICT=>1})->parse(undef,q(
-                <<TestInstructor<INSTRUCTOR>TEST>>
+            # New instance doesn't mask it for being global, is it still there?
+            CNFParser->new(undef,{STRICT=>1, ENABLE_WARNINGS=>1})->parse(undef,q(
+                <<GenericInstructionHandler<INSTRUCTOR>
+                #called  the following:
+                     TEST
+                >>
                 
             ));            
-            print $test->failed("Test failed! Trying to overwrite existing instruction, which are global.");
+            print $test->failed("Test failed! Passed to overwrite existing instruction, which are global.");
         }catch{
             $test->passed("Passed fail on trying to overwrite existing instruction, which are global.");            
         }
 
-      
+         
     $test-> nextCase();
 
 
+    $test->case('Test instructor to generate property.');
+
+    my $parser  = CNFParser->new(undef,{STRICT=>1, ENABLE_WARNINGS=>1})->parse(undef,q(
+                <<GenericInstructionHandler<INSTRUCTOR>
+                flag:1
+                TEST_ME
+                >>
+                <<MY_PROP<TEST_ME>
+                        A:1
+                        B:2
+                        Some multi line
+                        VALUE is HERE!
+                >>
+                
+            )); 
+    my $mp = $parser -> property('MY_PROP');
+    $test->isDefined("\$MY_PROP", $mp);
+    $test->evaluate("\$MY_PROP->val()","Some multi line\nVALUE is HERE!",$mp->val());
+
+    $test -> nextCase();
+
+
    ###
    # List entry with non reserved word instruction.
    ###