https://gcc.gnu.org/g:427972b2f1335c7430785ad4afd15386a17156ec
commit r15-8076-g427972b2f1335c7430785ad4afd15386a17156ec Author: Robert Dubner <rdub...@symas.com> Date: Sun Mar 16 12:20:01 2025 -0400 cobol: add cobol.dg/group1/escape.cob test; modify cobol.dg/gd.exp to handle it 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. Diff: --- gcc/testsuite/cobol.dg/dg.exp | 17 +++++++++++++++-- gcc/testsuite/cobol.dg/group1/escape.cob | 11 +++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/cobol.dg/dg.exp b/gcc/testsuite/cobol.dg/dg.exp index e75e3ab18954..d40cbd54e99d 100644 --- a/gcc/testsuite/cobol.dg/dg.exp +++ b/gcc/testsuite/cobol.dg/dg.exp @@ -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 index 000000000000..0ab52398cfe3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group1/escape.cob @@ -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.