diff options
| author | st0012 <stan001212@gmail.com> | 2022-06-28 14:39:56 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2022-07-16 02:30:23 +0900 |
| commit | 36ca0e58b600f3338ad4880d77c8c7fbc8f51460 (patch) | |
| tree | 31bc41b1c4b4526f10c72cec587d5e66a6d945da /test/reline/test_config.rb | |
| parent | 280b805d040fa537d5a459b40d4bfa6d49700905 (diff) | |
[ruby/reline] Use color name instead of code (integer) in dialog color APIs
As pointed out in the
[comment](https://github.com/ruby/reline/pull/413#issuecomment-1168033973),
the code is actually a control sequence and not only for colors.
To make the dialog color APIs safer to use, we should restrict its
usages and extract away the bg/fg concept from the input.
So in this commit, I made these changes:
1. The dialog_*_bg/fg_color APIs only takes and returns color names (symbol):
- :black
- :red
- :green
- :yellow
- :blue
- :magenta
- :cyan
- :white
2. Add additional dialog_*_bg/fg_color_sequence APIs to access the raw code.
https://github.com/ruby/reline/commit/b32a977766
Diffstat (limited to 'test/reline/test_config.rb')
| -rw-r--r-- | test/reline/test_config.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/reline/test_config.rb b/test/reline/test_config.rb index 234eee11f7..eaee2fd580 100644 --- a/test/reline/test_config.rb +++ b/test/reline/test_config.rb @@ -411,16 +411,16 @@ class Reline::Config::Test < Reline::TestCase def test_dialog_configurations @config.read_lines(<<~LINES.lines) - set dialog-default-bg-color 1 - set dialog-pointer-bg-color 2 - set dialog-default-fg-color 3 - set dialog-pointer-fg-color 4 + set dialog-default-bg-color white + set dialog-pointer-bg-color black + set dialog-default-fg-color cyan + set dialog-pointer-fg-color magenta LINES - assert_equal 1, @config.dialog_default_bg_color - assert_equal 2, @config.dialog_pointer_bg_color - assert_equal 3, @config.dialog_default_fg_color - assert_equal 4, @config.dialog_pointer_fg_color + assert_equal :white, @config.dialog_default_bg_color + assert_equal :black, @config.dialog_pointer_bg_color + assert_equal :cyan, @config.dialog_default_fg_color + assert_equal :magenta, @config.dialog_pointer_fg_color end end |
