Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Naatan committed Sep 13, 2023
1 parent 5d89cf8 commit c57d3fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
15 changes: 5 additions & 10 deletions helpers_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ func Test_cleanPtySequences(t *testing.T) {
[]byte("\u001B[1mfoo"),
0,
[]byte("foo"),
0,
// Since the cleaner handles an absolute cursor position against relative output, we can't determine start
// of output and so we return a negative
-1,
},
{
"Cursor character (NOT position)",
Expand All @@ -105,21 +107,14 @@ func Test_cleanPtySequences(t *testing.T) {
[]byte("\x1b[Hfoo"),
0,
[]byte("foo"),
0,
-1,
},
{
"Home key with Window title following",
[]byte("\x1b[H\x1b]0;C:\\Windows\\System32\\cmd.exe\afoo"),
0,
[]byte("foo"),
0,
},
{
"Complex",
[]byte("\x1b[?25l\x1b[2J\x1b[m\x1b[H\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\x1b[H\x1b]0;C:\\Users\\Nathan\\AppData\\Local\\Temp\\847774304\\bin\\state.exe\a\x1b[?25h"),
0,
[]byte(""),
0,
-1,
},
}
for _, tt := range tests {
Expand Down
12 changes: 6 additions & 6 deletions outputproducer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func Test_outputProducer_cleanOutput(t *testing.T) {
}{
{
"Do not sanitize unfinished",
&outputProducer{},
newOutputProducer(newTestOpts(nil, t)),
0,
0,
func([]byte, int) ([]byte, int, error) {
Expand All @@ -343,7 +343,7 @@ func Test_outputProducer_cleanOutput(t *testing.T) {
},
{
"Sanitize finished",
&outputProducer{},
newOutputProducer(newTestOpts(nil, t)),
0,
0,
func([]byte, int) ([]byte, int, error) {
Expand All @@ -364,7 +364,7 @@ func Test_outputProducer_cleanOutput(t *testing.T) {
},
{
"Sanitize up to final line end",
&outputProducer{},
newOutputProducer(newTestOpts(nil, t)),
0,
0,
phraseSanitizer,
Expand All @@ -383,7 +383,7 @@ func Test_outputProducer_cleanOutput(t *testing.T) {
},
{
"Sanitize from pos up to final line end",
&outputProducer{},
newOutputProducer(newTestOpts(nil, t)),
0,
21,
phraseSanitizer,
Expand All @@ -402,7 +402,7 @@ func Test_outputProducer_cleanOutput(t *testing.T) {
},
{
"Consecutive Invocations",
&outputProducer{},
newOutputProducer(newTestOpts(nil, t)),
0,
0,
incrementalPhraseSanitizer,
Expand Down Expand Up @@ -459,7 +459,7 @@ func Test_outputProducer_cleanOutput(t *testing.T) {
},
{
"Cursor Movement",
&outputProducer{},
newOutputProducer(newTestOpts(nil, t)),
27, // Space before "me" in "sanitize me"
18, // End of first linebreak
func([]byte, int) ([]byte, int, error) {
Expand Down

0 comments on commit c57d3fb

Please sign in to comment.