Skip to content

Commit

Permalink
add a test using mock
Browse files Browse the repository at this point in the history
  • Loading branch information
hasumikin committed Nov 9, 2023
1 parent 80a5644 commit 49168c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/reline/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

require 'reline'
require 'test/unit'
require 'test/unit/rr'

begin
require 'rbconfig'
Expand Down
9 changes: 8 additions & 1 deletion test/reline/test_face.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ def test_invalid_rgb?
assert_equal false, @config.send(:rgb_expression?, "#FFFFF")
end

def test_format_to_sgr_preserves_order
def test_define_method_proxies_the_order_of_arguments
mock(@config).format_to_sgr(
[[:foreground, :blue], [:style, [:bold, :italicized]], [:background, :red]]
)
@config.define :default, foreground: :blue, style: [:bold, :italicized], background: :red
end

def test_format_to_sgr_preserves_order_of_values
assert_equal(
"#{RESET_SGR}\e[37;41;1;3m",
@config.send(:format_to_sgr, foreground: :white, background: :red, style: [:bold, :italicized])
Expand Down

0 comments on commit 49168c8

Please sign in to comment.