diff --git a/test/reline/test_config.rb b/test/reline/test_config.rb index 0d769a7cb4..68a102a599 100644 --- a/test/reline/test_config.rb +++ b/test/reline/test_config.rb @@ -24,8 +24,12 @@ def teardown ENV['INPUTRC'] = @inputrc_backup end + def get_config_variable(variable) + @config.instance_variable_get(variable) + end + def additional_key_bindings(keymap_label) - @config.instance_variable_get(:@additional_key_bindings)[keymap_label].instance_variable_get(:@key_bindings) + get_config_variable(:@additional_key_bindings)[keymap_label].instance_variable_get(:@key_bindings) end def registered_key_bindings(keys) @@ -38,7 +42,7 @@ def test_read_lines set show-mode-in-prompt on LINES - assert_equal true, @config.instance_variable_get(:@show_mode_in_prompt) + assert_equal true, get_config_variable(:@show_mode_in_prompt) end def test_read_lines_with_variable @@ -46,7 +50,7 @@ def test_read_lines_with_variable set disable-completion on LINES - assert_equal true, @config.instance_variable_get(:@disable_completion) + assert_equal true, get_config_variable(:@disable_completion) end def test_string_value @@ -55,7 +59,7 @@ def test_string_value set emacs-mode-string Emacs LINES - assert_equal 'Emacs', @config.instance_variable_get(:@emacs_mode_string) + assert_equal 'Emacs', get_config_variable(:@emacs_mode_string) end def test_string_value_with_brackets @@ -64,7 +68,7 @@ def test_string_value_with_brackets set emacs-mode-string [Emacs] LINES - assert_equal '[Emacs]', @config.instance_variable_get(:@emacs_mode_string) + assert_equal '[Emacs]', get_config_variable(:@emacs_mode_string) end def test_string_value_with_brackets_and_quotes @@ -73,7 +77,7 @@ def test_string_value_with_brackets_and_quotes set emacs-mode-string "[Emacs]" LINES - assert_equal '[Emacs]', @config.instance_variable_get(:@emacs_mode_string) + assert_equal '[Emacs]', get_config_variable(:@emacs_mode_string) end def test_string_value_with_parens @@ -82,7 +86,7 @@ def test_string_value_with_parens set emacs-mode-string (Emacs) LINES - assert_equal '(Emacs)', @config.instance_variable_get(:@emacs_mode_string) + assert_equal '(Emacs)', get_config_variable(:@emacs_mode_string) end def test_string_value_with_parens_and_quotes @@ -91,7 +95,7 @@ def test_string_value_with_parens_and_quotes set emacs-mode-string "(Emacs)" LINES - assert_equal '(Emacs)', @config.instance_variable_get(:@emacs_mode_string) + assert_equal '(Emacs)', get_config_variable(:@emacs_mode_string) end def test_encoding_is_ascii @@ -169,7 +173,7 @@ def test_include $include included_partial LINES - assert_equal true, @config.instance_variable_get(:@show_mode_in_prompt) + assert_equal true, get_config_variable(:@show_mode_in_prompt) end def test_include_expand_path @@ -184,7 +188,7 @@ def test_include_expand_path $include ~/included_partial LINES - assert_equal true, @config.instance_variable_get(:@show_mode_in_prompt) + assert_equal true, get_config_variable(:@show_mode_in_prompt) ensure ENV['HOME'] = home_backup end @@ -198,7 +202,7 @@ def test_if $endif LINES - assert_equal '(cmd)', @config.instance_variable_get(:@vi_cmd_mode_string) + assert_equal '(cmd)', get_config_variable(:@vi_cmd_mode_string) end def test_if_with_false @@ -210,7 +214,7 @@ def test_if_with_false $endif LINES - assert_equal '[cmd]', @config.instance_variable_get(:@vi_cmd_mode_string) + assert_equal '[cmd]', get_config_variable(:@vi_cmd_mode_string) end def test_if_with_indent @@ -224,7 +228,7 @@ def test_if_with_indent $endif LINES - assert_equal '(cmd)', @config.instance_variable_get(:@vi_cmd_mode_string) + assert_equal '(cmd)', get_config_variable(:@vi_cmd_mode_string) end end @@ -446,7 +450,7 @@ def test_history_size set history-size 5000 LINES - assert_equal 5000, @config.instance_variable_get(:@history_size) + assert_equal 5000, get_config_variable(:@history_size) history = Reline::History.new(@config) history << "a\n" assert_equal 1, history.size @@ -477,7 +481,7 @@ def test_inputrc_raw_value set vi-ins-mode-string aaa aaa set vi-cmd-mode-string bbb ccc # comment LINES - assert_equal :vi_insert, @config.instance_variable_get(:@editing_mode_label) + assert_equal :vi_insert, get_config_variable(:@editing_mode_label) assert_equal 'aaa aaa', @config.vi_ins_mode_string assert_equal 'bbb ccc # comment', @config.vi_cmd_mode_string end