]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cobol: add cobol.dg/group1/escape.cob test; modify cobol.dg/gd.exp to handle it
authorRobert Dubner <rdubner@symas.com>
Sun, 16 Mar 2025 16:20:01 +0000 (12:20 -0400)
committerRobert Dubner <rdubner@symas.com>
Sun, 16 Mar 2025 19:45:38 +0000 (15:45 -0400)
gcc/testsuite

* cobol.dg/dg.exp: modified to recurse into directories without
.exp files and find *.cob files therein.
* cobol.dg/group1/escape.cob: New testcase.

gcc/testsuite/cobol.dg/dg.exp
gcc/testsuite/cobol.dg/group1/escape.cob [new file with mode: 0644]

index e75e3ab18954722f662ad244d00b696b082c869e..d40cbd54e99d036c0b1912cf5f0bd692dae09acb 100644 (file)
@@ -33,10 +33,23 @@ set cobol_test_path $srcdir/$subdir
 
 set all_flags $DEFAULT_COBFLAGS
 
+# Recursively find files in $dir and subdirs, do not walk into subdirs 
+# that contain their own .exp file.
+proc find-cob-tests { dir suffix } {
+    set tests [lsort [glob -nocomplain -directory $dir "*.$suffix" ]]
+    foreach subdir [lsort [glob -nocomplain -type d -directory $dir *]] {
+        if { [glob -nocomplain -directory $subdir *.exp] eq "" } {
+            eval lappend tests [find-cob-tests $subdir $suffix]
+        }
+    }
+    return $tests
+}
+
+set tests [find-cob-tests $srcdir/$subdir {cob}]
+
 # Main loop.
 if [check_effective_target_cobol] {
-    cobol-dg-runtest [lsort \
-       [glob -nocomplain $srcdir/$subdir/*.cob ] ] "" $all_flags
+    cobol-dg-runtest $tests "" $all_flags
 }
 
 # All done.
diff --git a/gcc/testsuite/cobol.dg/group1/escape.cob b/gcc/testsuite/cobol.dg/group1/escape.cob
new file mode 100644 (file)
index 0000000..0ab5239
--- /dev/null
@@ -0,0 +1,11 @@
+*> { dg-do run }
+*> { dg-output {Testing the testing(\n|\r|\r\n)} }
+*> { dg-output {\.\^\$\*\+\-\?\(\)\[\]\{\}\\\|(\n|\r|\r\n)} }
+*> { dg-output {"\.\^\$\*\+\-\?\(\)\[\]\{\}\\\|"} }
+        identification division.
+        program-id. escape.
+        procedure division.
+        display "Testing the testing"
+        display ".^$*+-?()[]{}\|"  
+        display '".^$*+-?()[]{}\|"'  .
+        end program escape.