[binutils-gdb] gdb/testsuite: remove duplicate test from gdb.cp/maint.exp

Andrew Burgess aburgess@sourceware.org
Fri Mar 26 15:03:30 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=baecbb3dc8314d2c91bfda38eedbcc2911397424

commit baecbb3dc8314d2c91bfda38eedbcc2911397424
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Wed Mar 17 09:19:50 2021 +0000

    gdb/testsuite: remove duplicate test from gdb.cp/maint.exp
    
    I wanted to remove the duplicate test name from gdb.cp/maint.exp.  In
    this test we run some checks against different operator names.  For
    one operator we test with a variable number of spaces.  However, we
    were accidentally testing the one space version twice, and the zero
    space version not at all, leading to a duplicate test name.
    
    I could have just changed the duplicate one space version into the
    missing zero space version, but I thought it would be neater to wrap
    multiple tests in a loop, and check all operators with either zero,
    one, or two spaces.
    
    These tests are super quick so take almost no extra time, and this
    gives marginally more test coverage.
    
    gdb/testsuite/ChangeLog:
    
            * gdb.cp/maint.exp (test_first_component): Run more tests with a
            variable number of spaces, this removes the duplicate testing of
            'operator ->' which existed before.

Diff:
---
 gdb/testsuite/ChangeLog        |  6 ++++++
 gdb/testsuite/gdb.cp/maint.exp | 31 ++++++++++++++++---------------
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3fe36b3db46..8e603630c1e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2021-03-26  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* gdb.cp/maint.exp (test_first_component): Run more tests with a
+	variable number of spaces, this removes the duplicate testing of
+	'operator ->' which existed before.
+
 2021-03-26  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* gdb.cp/gdb2384.cc (main): Change comments used for breakpoints.
diff --git a/gdb/testsuite/gdb.cp/maint.exp b/gdb/testsuite/gdb.cp/maint.exp
index 0f83b173714..358c1a40267 100644
--- a/gdb/testsuite/gdb.cp/maint.exp
+++ b/gdb/testsuite/gdb.cp/maint.exp
@@ -61,21 +61,22 @@ proc test_first_component {} {
     gdb_test_no_output "set complaints 1000"
 
     test_single_component "foo"
-    test_single_component "operator<<"
-    test_single_component "operator>>"
-    test_single_component "operator ->"
-    test_single_component "operator()"
-    test_single_component "operator>"
-    test_single_component "operator<"
-    test_single_component "operator ->"
-    test_single_component "operator  ->"
-
-    test_single_component "foo()"
-    test_single_component "foo(int)"
-    test_single_component "foo(X::Y)"
-    test_single_component "foo(X::Y, A::B)"
-    test_single_component "foo(std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >)"
-    test_single_component "operator>(X::Y)"
+
+    foreach spc [list "" " " "  "] {
+	test_single_component "operator${spc}<<"
+	test_single_component "operator${spc}>>"
+	test_single_component "operator${spc}->"
+	test_single_component "operator${spc}()"
+	test_single_component "operator${spc}>"
+	test_single_component "operator${spc}<"
+
+	test_single_component "foo${spc}()"
+	test_single_component "foo${spc}(int)"
+	test_single_component "foo${spc}(X::Y)"
+	test_single_component "foo${spc}(X::Y, A::B)"
+	test_single_component "foo${spc}(std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >)"
+	test_single_component "operator>${spc}(X::Y)"
+    }
 
     # Operator names can show up in weird places.


More information about the Gdb-cvs mailing list