pkg/term: refactor TestEscapeProxyRead#39800
Conversation
- use subtests to make it clearer what the individual test-cases are, and to prevent tests from depending on values set by the previous test(s). - remove redundant messages in assert (gotest.tools already prints a useful message if assertions fail). Signed-off-by: Sebastiaan van Stijn <[email protected]>
Windows RS5: This one may be racy; https://ci.docker.com/public/blue/rest/organizations/jenkins/pipelines/moby/branches/PR-39800/runs/1/nodes/192/log/?start=0 |
|
ping @kolyshkin @vdemeester PTAL 🤗 |
vdemeester
left a comment
There was a problem hiding this comment.
@thaJeztah Nice ! 😉 we may even be able to use test tables to reduce a bit the duplication of code
that's what I tried at the start, but although they look very similar, there's quite some subtle differences between the tests, and writing a table for that resulted in a lot of |
| assert.DeepEqual(t, keys, buf) | ||
| }) | ||
|
|
||
| t.Run("ctrl-c,ctrl-z escape key, keys ctrl-c,ctrl-z", func(t *testing.T) { |
There was a problem hiding this comment.
nit: in the test name I would use the ctrl-c,ctrl-z escape key, keys [ctrl-c],[ctrl-z] format, because the sequence of reads matters, for example on my PR I have a test for [ctrl-c,ctrl-z] (a single read with 2 bytes), which doesn't work with the current code.
I can as well change the format on my PR when I rebase.
There was a problem hiding this comment.
Ah, good suggestion; yes, perhaps ok to touch-up those as part of your PR
|
@kolyshkin @vdemeester LGTY? |
noticed this test while reviewing #39728, and did some refactoring
are, and to prevent tests from depending on values set by the
previous test(s).
a useful message if assertions fail).