From: Robert Dubner Date: Sun, 16 Mar 2025 16:20:01 +0000 (-0400) Subject: cobol: add cobol.dg/group1/escape.cob test; modify cobol.dg/gd.exp to handle it X-Git-Tag: basepoints/gcc-16~1477 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=427972b2f1335c7430785ad4afd15386a17156ec;p=thirdparty%2Fgcc.git 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 --git a/gcc/testsuite/cobol.dg/dg.exp b/gcc/testsuite/cobol.dg/dg.exp index e75e3ab1895..d40cbd54e99 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 00000000000..0ab52398cfe --- /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.