Skip to content

Commit 55178bd

Browse files
lePicimichalvasko
authored andcommitted
yanglint BUGFIX restore terminal after tests
The problem is with the 'stty columns' command, which is set to a high number in the tests to be sure to correctly capture long strings. But this command persist even after the tests, so e.g. the 'vim' program will display incorrectly.
1 parent b231ad2 commit 55178bd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/yanglint/interactive/all.tcl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
package require tcltest
2+
package require Expect
3+
4+
# Save current terminal size
5+
set stty_output [exec stty size]
6+
scan $stty_output "%d %d" orig_lines orig_columns
7+
# setting some large terminal width
8+
stty columns 720
29

310
# Hook to determine if any of the tests failed.
411
# Sets a global variable exitCode to 1 if any test fails otherwise it is set to 0.
@@ -11,5 +18,10 @@ if {[info exists ::env(TESTS_DIR)]} {
1118
tcltest::configure -testdir "$env(TESTS_DIR)/interactive"
1219
}
1320

21+
# run all interactive tests
1422
tcltest::runAllTests
23+
24+
# Restore original terminal size
25+
exec stty rows $orig_lines cols $orig_columns
26+
1527
exit $exitCode

tests/yanglint/interactive/ly.tcl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ set timeout 5
1313
set prompt "> "
1414
# turn off dialog between expect and yanglint
1515
log_user 0
16-
# setting some large terminal width
17-
stty columns 720
1816

1917
# default setup for every unit test
2018
variable ly_setup {

0 commit comments

Comments
 (0)