Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
7982173f
Commit
7982173f
authored
Dec 15, 2010
by
antirez
Browse files
print test names inline in the non verbose output mode
parent
eae9cce1
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/support/test.tcl
View file @
7982173f
...
@@ -44,8 +44,22 @@ proc assert_type {type key} {
...
@@ -44,8 +44,22 @@ proc assert_type {type key} {
assert_equal $type
[
r type $key
]
assert_equal $type
[
r type $key
]
}
}
# This is called before starting the test
proc announce_test
{
s
}
{
if
{[
info exists ::env
(
TERM
)]
&&
[
string match $::env
(
TERM
)
xterm
]}
{
puts -nonewline
"
$s
\033\[
0K"
flush stdout
set ::backward_count
[
string length $s
]
}
}
# This is called after the test finished
proc colored_dot
{
tags passed
}
{
proc colored_dot
{
tags passed
}
{
if
{[
info exists ::env
(
TERM
)]
&&
[
string match $::env
(
TERM
)
xterm
]}
{
if
{[
info exists ::env
(
TERM
)]
&&
[
string match $::env
(
TERM
)
xterm
]}
{
# Go backward and delete what announc_test function printed.
puts -nonewline
"
\033\[
${::backward_count}
D
\033\[
0K
\033\[
J"
# Print a coloured char, accordingly to test outcome and tags.
if
{[
lsearch $tags list
]
!= -1
}
{
if
{[
lsearch $tags list
]
!= -1
}
{
set colorcode
{
31
}
set colorcode
{
31
}
set ch L
set ch L
...
@@ -115,6 +129,8 @@ proc test {name code {okpattern undefined}} {
...
@@ -115,6 +129,8 @@ proc test {name code {okpattern undefined}} {
if
{
$::verbose
}
{
if
{
$::verbose
}
{
puts -nonewline
[
format
"#%03d %-68s "
$::num_tests $name
]
puts -nonewline
[
format
"#%03d %-68s "
$::num_tests $name
]
flush stdout
flush stdout
}
else
{
announce_test $name
}
}
if
{[
catch
{
set retval
[
uplevel 1 $code
]}
error
]}
{
if
{[
catch
{
set retval
[
uplevel 1 $code
]}
error
]}
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment