Skip to content

switch to use blackbox testing, rewrite TestEscapeProxyRead to a table test - #35

Open
thaJeztah wants to merge 3 commits into
moby:mainfrom
thaJeztah:blackbox_testing
Open

thaJeztah wants to merge 3 commits into
moby:mainfrom
thaJeztah:blackbox_testing

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Nov 5, 2022 •

Copy link
Copy Markdown
Member

@thaJeztah
thaJeztah force-pushed the blackbox_testing branch 3 times, most recently from d2ad08c to d2f5e41 Compare November 5, 2022 22:20
@thaJeztah
thaJeztah marked this pull request as ready for review December 5, 2022 13:07
@thaJeztah

Copy link
Copy Markdown
Member Author

Okay, moved this out of draft for consideration.

Comment thread test/term_test.go
Comment on lines -50 to +51
newSize := Winsize{Width: 200, Height: 200, x: winSize.x, y: winSize.y}
newSize := Winsize{Width: 200, Height: 200}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think this was the bit I was still looking at. It's somewhat unclear why x and y aren't exported; effectively WinSize in this module is identical to golang.org/x/sys/unix.Winsize`;

Type in this module:

// Winsize represents the size of the terminal window.
type Winsize struct {
	Height uint16
	Width  uint16
	x      uint16
	y      uint16
}

And in golang.org/x/sys:

type Winsize struct {
	Row    uint16
	Col    uint16
	Xpixel uint16
	Ypixel uint16
}

In this module, we're converting the types between, so perhaps instead we should make it an alias (and deprecate the local type). Let me look at that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I recall now; for Windows, it's a different type, so we can make it an alias (but only on !windows)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm.. nevermind; field names are different 🤦

@thaJeztah
thaJeztah marked this pull request as draft April 30, 2023 22:04
@thaJeztah
thaJeztah force-pushed the blackbox_testing branch 2 times, most recently from a6a5c39 to 3e71216 Compare May 2, 2023 12:07
@thaJeztah
thaJeztah force-pushed the blackbox_testing branch 2 times, most recently from c20e276 to ff86c79 Compare January 2, 2025 15:41
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah changed the title switch to use blackbox testing, move tests to separate module switch to use blackbox testing, rewrite TestEscapeProxyRead to a table test Oct 27, 2026
@thaJeztah
thaJeztah marked this pull request as ready for review October 27, 2026 14:12
@thaJeztah
thaJeztah requested a balanced review from Copilot October 27, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review found no blocking issues in this test-only refactor; tests were not executed.

No open issues 🎉

What changed in this PR

This test-only refactor moves the ASCII and escape-proxy tests to the external term_test package and simplifies existing test code without changing production behavior.

Changes:

  • Rewrites TestEscapeProxyRead as a table-driven test while retaining existing scenarios.
  • Uses exported APIs in the ASCII and escape-proxy tests.
  • Simplifies Unix test cleanup and removes reliance on private window-size fields.
File Description
term_unix_test.go Simplifies cleanup and window-size initialization.
proxy_test.go Converts escape-proxy tests to table-driven black-box tests.
ascii_test.go Tests ToBytes through the exported package API.

Review effort: Balanced

@thaJeztah
thaJeztah requested a review from vvoland October 27, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants