gh-106970: Fix Argument Clinic 'destination <name> clear' command (#106972)

Add test for the 'destination <name> clear' command,
and the 'destination' directive in general.

Fix two bugs in 'destination <name> clear' command:

1. The text attribute of the allocator is called 'text', not '_text'
2. Return after processing the 'clear' command,
   instead of proceeding directly to the fail().
This commit is contained in:
Erlend E. Aasland 2023-07-22 09:43:13 +02:00 committed by GitHub
parent cdeb1a6caa
commit 3372bcba98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 8 deletions

View file

@ -249,6 +249,15 @@ class ClinicWholeFileTest(_ParserBase):
out = self.expect_failure(raw)
self.assertEqual(out, msg)
def test_unknown_destination_command(self):
out = self.expect_failure("""
/*[clinic input]
destination buffer nosuchcommand
[clinic start generated code]*/
""")
msg = "unknown destination command 'nosuchcommand'"
self.assertIn(msg, out)
class ClinicGroupPermuterTest(TestCase):
def _test(self, l, m, r, output):