Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Increase coverage for 'destination' directive
  • Loading branch information
erlend-aasland committed Jul 21, 2023
commit 4cf2ab2c9954e78aa9684252a19ff932b2377bc0
34 changes: 31 additions & 3 deletions Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4957,7 +4957,7 @@ output preset buffer
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5bff3376ee0df0b5]*/

/*[clinic input]
Test.buffer_clear
buffer_clear
a: int
We'll call 'destination buffer clear' after this.

Expand All @@ -4968,11 +4968,39 @@ the 'block' destination, so we should expect everything but
[clinic start generated code]*/

static PyObject *
Test_buffer_clear_impl(TestObj *self, int a)
/*[clinic end generated code: output=81e8d6b61d853f53 input=1d662d73d4164244]*/
buffer_clear_impl(PyObject *module, int a)
/*[clinic end generated code: output=f14bba74677e1846 input=a4c308a6fdab043c]*/

/*[clinic input]
destination buffer clear
output pop
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f20d06adb8252084]*/


/*[clinic input]
output push
destination test1 new buffer
output everything suppress
output docstring_definition test1
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5a77c454970992fc]*/

/*[clinic input]
new_dest
a: int
Only this docstring should be outputted to test1.
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=da5af421ed8996ed]*/

/*[clinic input]
dump test1
output pop
[clinic start generated code]*/

PyDoc_STRVAR(new_dest__doc__,
"new_dest($module, /, a)\n"
"--\n"
"\n"
"Only this docstring should be outputted to test1.");
/*[clinic end generated code: output=9cac703f51d90e84 input=090db8df4945576d]*/
9 changes: 9 additions & 0 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ def test_cpp_monitor_fail_no_matching_if(self):
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):
Expand Down