)]}'
{
  "commit": "86a839999883bc9d3ca304b0806cf50e171587cd",
  "tree": "094503213ca338efea23f2eaf13ede81a6803fdc",
  "parents": [
    "0d3ca327972d34eeb4b74cf239aab3bf973a3c97"
  ],
  "author": {
    "name": "Lancelot SIX",
    "email": "lsix@lancelotsix.com",
    "time": "Sat Nov 20 23:20:23 2021 +0000"
  },
  "committer": {
    "name": "Lancelot SIX",
    "email": "lsix@lancelotsix.com",
    "time": "Fri Jan 07 22:43:33 2022 +0000"
  },
  "message": "gdb: completion-support.exp: improve leading whitespace support\n\nThere is a expect support library in the source tree designed to help\ndevelopers test the auto-completion capabilities of GDB.\n\nOne of the functions is test_gdb_complete_unique_re.  It is used\n(usually indirectly via test_gdb_complete_unique) to test that a given\ninput line is completed as a given output line.  The test checks for two\nways to do the completion: using tab-completion, or using the\n\u0027complete\u0027 command.  To do this, calls to two dedicated functions are\nperformed.  If we omit few details, we can consider that a call to\n\n    test_gdb_complete_unique $input $expected\n\nis equivalent to the two following calls:\n\n    test_gdb_complete_tab_unique $input $expected\n    test_gdb_complete_cmd_unique $input $expected\n\nWhen using the tab-completion, everything works as expected, but some\ncare must be taken when using the \u0027complete\u0027 command if the given input\nhas leading whitespaces.  In such situation, the output of the\n\u0027complete\u0027 command will drop the leading whitespaces.\n\nThe current approach is that in such situation, the input and expected\noutputs are right trimmed (i.e. all leading whitespaces are removed)\nwhen performing the command completion check.\n\nThis means that the following call:\n\n    test_gdb_complete_unique \"   $input\" \"   $expected\"\n\nis almost equivalent to (again, omitting few details and arguments):\n\n    test_gdb_complete_tab_unique \"   $input\" \"   $expected\"\n    test_gdb_complete_cmd_unique \"$input\" \"$expected\"\n\nThis approach comes with a problem that we encounter when running the\ntests in complete-empty.exp.  When doing so, we have:\n\n    Running .../gdb/testsuite/gdb.base/complete-empty.exp ...\n    DUPLICATE: gdb.base/complete-empty.exp: empty-input-line: cmd complete \"\"\n\nThis is because the test file does something like:\n\n    test_gdb_complete_unique \"\" \"!\" \" \" 1\n    test_gdb_complete_unique \"   \" \"   !\" \" \" 1¬\n\nwhich, if we do the substitution introduced above is equivalent to:\n\n    test_gdb_complete_tab_unique \"\" \"!\"\n    test_gdb_complete_cmd_unique \"\" \"!\"\n    test_gdb_complete_tab_unique \"   \" \"   !\"\n    test_gdb_complete_cmd_unique \"\" \"!\"\n\nWe see that the lines 2 and 4 are now the same, and for this reason the\ntesting framework complains about DUPLICATE test names.\n\nTo fix that, this commit proposes that instead of left trimming both\ninput and expected outputs, only the expected output is trimmed.\n\nCare must be taken in the case the completion gives more possibilities\nthan allowed by the max-completions setting.  In this case, the input\nwill be repeated in the output in its left trimmed version.  This commit\nalso ensures that this is taken care of.\n\nWith this commit, the gdb.base/complete-empty.exp still passes all its\ntests but does not report the DUPLICATE anymore.\n\nTested on x86_64-linux.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "52b1bcc3f328004fe161b78235d87d9dbd4e38de",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/lib/completion-support.exp",
      "new_id": "30d3461c22687c0cc5ab530f2a9f6f3f1fbb3310",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/lib/completion-support.exp"
    }
  ]
}
