-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for output of ANSI-colored text #80
base: master
Are you sure you want to change the base?
Conversation
b573a06
to
63ad634
Compare
Will rebase onto current master... |
63ad634
to
32ac773
Compare
32ac773
to
afa3e17
Compare
Initially, I was thinking about a command line option --color to deal with color. However, I see that busted also used an outputter approach to deal with the color thing, so why not... However, the text output itself should be identical with and without colors. Internally, the best way to go is to make this an option of the general text outputting class. I did not check your branch under windows yet, but as far as I know, unix color codes don't work in the default windows console. [Googling a bit on the topic] So, on windows 10, ansi color codes work out of the box. On previous versions of windows, using program such as ansicon can make them work but I find the approach tedious. So, as first step, let's just enable colors on unix. We will improve later on Windows support. |
I selected the "outputter" class as a natural approach at first, but I do agree that we're duplicating code from the text output. And I assume that we don't expect to require any other output that would be 'colored'? Re-uniting the code should be straightforward enough. We could start with a COLOR table that initially holds empty strings, and only set those (to the needed control sequences) when |
afa3e17
to
593a3e3
Compare
593a3e3
to
b7d7722
Compare
Fixed typo in commit message, rebased to current |
b7d7722
to
86ba472
Compare
The output routine for a single failed test isn't used anywhere else, so there's no need to make it a separate function.
The text outputter will now automatically insert (control) string fields from the COLOR table. By default, these are all empty, so "plain" text output is unchanged. Use the new "--color" option to activate ANSI colors.
86ba472
to
c6aa528
Compare
This is eye-candy based on the existing "text" class, augmented by ANSI control sequences for different colors.
To use it, request "color" output, e.g.:
./run_functional_tests.lua -v --output color