summaryrefslogtreecommitdiff
path: root/test/reline
diff options
context:
space:
mode:
authorStan Lo <[email protected]>2023-11-06 15:53:34 +0000
committergit <[email protected]>2023-11-06 15:53:38 +0000
commit2dd32e7c3b6904e61b9068596f5e4e82920c1fb0 (patch)
treefe8b8d3d90854a384a62d05b9c7933724b25d00a /test/reline
parent16403f41abcbaccf32484d10575d3542dbb3247e (diff)
[ruby/reline] Test Reline::Face without mocking
(https://github.com/ruby/reline/pull/600) * Test Reline::Face without mocking Because `test-unit-rr` is not a default gem, using it would break CRuby's CI. * Add ruby-core workflow https://github.com/ruby/reline/commit/d2189ac436
Diffstat (limited to 'test/reline')
-rw-r--r--test/reline/helper.rb1
-rw-r--r--test/reline/test_face.rb18
2 files changed, 6 insertions, 13 deletions
diff --git a/test/reline/helper.rb b/test/reline/helper.rb
index 4d0c883c86..fb2262e7f5 100644
--- a/test/reline/helper.rb
+++ b/test/reline/helper.rb
@@ -4,7 +4,6 @@ ENV['TERM'] = 'xterm' # for some CI environments
require 'reline'
require 'test/unit'
-require 'test/unit/rr'
begin
require 'rbconfig'
diff --git a/test/reline/test_face.rb b/test/reline/test_face.rb
index 371b4b0d2e..14da4f6d65 100644
--- a/test/reline/test_face.rb
+++ b/test/reline/test_face.rb
@@ -151,17 +151,6 @@ class Reline::Face::Test < Reline::TestCase
@config = Reline::Face.const_get(:Config).new(:my_config) { }
end
- def test_the_order_of_define_values_should_be_preserved
- any_instance_of(Reline::Face.const_get(:Config)) do |config|
- mock(config).format_to_sgr(
- [[:foreground, :blue], [:style, [:bold, :italicized]], [:background, :red]]
- )
- end
- Reline::Face.config(:my_config) do |face|
- face.define :default, foreground: :blue, style: [:bold, :italicized], background: :red
- end
- end
-
def test_rgb?
assert_equal true, @config.send(:rgb_expression?, "#FFFFFF")
end
@@ -171,11 +160,16 @@ class Reline::Face::Test < Reline::TestCase
assert_equal false, @config.send(:rgb_expression?, "#FFFFF")
end
- def test_format_to_sgr
+ def test_format_to_sgr_preserves_order
assert_equal(
"#{RESET_SGR}\e[37;41;1;3m",
@config.send(:format_to_sgr, foreground: :white, background: :red, style: [:bold, :italicized])
)
+
+ assert_equal(
+ "#{RESET_SGR}\e[37;1;3;41m",
+ @config.send(:format_to_sgr, foreground: :white, style: [:bold, :italicized], background: :red)
+ )
end
def test_format_to_sgr_with_reset