@@ -24,8 +24,12 @@ def teardown
2424 ENV [ 'INPUTRC' ] = @inputrc_backup
2525 end
2626
27+ def get_config_variable ( variable )
28+ @config . instance_variable_get ( variable )
29+ end
30+
2731 def additional_key_bindings ( keymap_label )
28- @config . instance_variable_get ( :@additional_key_bindings ) [ keymap_label ] . instance_variable_get ( :@key_bindings )
32+ get_config_variable ( :@additional_key_bindings ) [ keymap_label ] . instance_variable_get ( :@key_bindings )
2933 end
3034
3135 def registered_key_bindings ( keys )
@@ -38,15 +42,15 @@ def test_read_lines
3842 set show-mode-in-prompt on
3943 LINES
4044
41- assert_equal true , @config . instance_variable_get ( :@show_mode_in_prompt )
45+ assert_equal true , get_config_variable ( :@show_mode_in_prompt )
4246 end
4347
4448 def test_read_lines_with_variable
4549 @config . read_lines ( <<~LINES . lines )
4650 set disable-completion on
4751 LINES
4852
49- assert_equal true , @config . instance_variable_get ( :@disable_completion )
53+ assert_equal true , get_config_variable ( :@disable_completion )
5054 end
5155
5256 def test_string_value
@@ -55,7 +59,7 @@ def test_string_value
5559 set emacs-mode-string Emacs
5660 LINES
5761
58- assert_equal 'Emacs' , @config . instance_variable_get ( :@emacs_mode_string )
62+ assert_equal 'Emacs' , get_config_variable ( :@emacs_mode_string )
5963 end
6064
6165 def test_string_value_with_brackets
@@ -64,7 +68,7 @@ def test_string_value_with_brackets
6468 set emacs-mode-string [Emacs]
6569 LINES
6670
67- assert_equal '[Emacs]' , @config . instance_variable_get ( :@emacs_mode_string )
71+ assert_equal '[Emacs]' , get_config_variable ( :@emacs_mode_string )
6872 end
6973
7074 def test_string_value_with_brackets_and_quotes
@@ -73,7 +77,7 @@ def test_string_value_with_brackets_and_quotes
7377 set emacs-mode-string "[Emacs]"
7478 LINES
7579
76- assert_equal '[Emacs]' , @config . instance_variable_get ( :@emacs_mode_string )
80+ assert_equal '[Emacs]' , get_config_variable ( :@emacs_mode_string )
7781 end
7882
7983 def test_string_value_with_parens
@@ -82,7 +86,7 @@ def test_string_value_with_parens
8286 set emacs-mode-string (Emacs)
8387 LINES
8488
85- assert_equal '(Emacs)' , @config . instance_variable_get ( :@emacs_mode_string )
89+ assert_equal '(Emacs)' , get_config_variable ( :@emacs_mode_string )
8690 end
8791
8892 def test_string_value_with_parens_and_quotes
@@ -91,7 +95,7 @@ def test_string_value_with_parens_and_quotes
9195 set emacs-mode-string "(Emacs)"
9296 LINES
9397
94- assert_equal '(Emacs)' , @config . instance_variable_get ( :@emacs_mode_string )
98+ assert_equal '(Emacs)' , get_config_variable ( :@emacs_mode_string )
9599 end
96100
97101 def test_encoding_is_ascii
@@ -105,7 +109,7 @@ def test_encoding_is_ascii
105109 def test_encoding_is_not_ascii
106110 @config = Reline ::Config . new
107111
108- assert_equal nil , @config . convert_meta
112+ assert_equal false , @config . convert_meta
109113 end
110114
111115 def test_invalid_keystroke
@@ -169,7 +173,7 @@ def test_include
169173 $include included_partial
170174 LINES
171175
172- assert_equal true , @config . instance_variable_get ( :@show_mode_in_prompt )
176+ assert_equal true , get_config_variable ( :@show_mode_in_prompt )
173177 end
174178
175179 def test_include_expand_path
@@ -184,7 +188,7 @@ def test_include_expand_path
184188 $include ~/included_partial
185189 LINES
186190
187- assert_equal true , @config . instance_variable_get ( :@show_mode_in_prompt )
191+ assert_equal true , get_config_variable ( :@show_mode_in_prompt )
188192 ensure
189193 ENV [ 'HOME' ] = home_backup
190194 end
@@ -198,7 +202,7 @@ def test_if
198202 $endif
199203 LINES
200204
201- assert_equal '(cmd)' , @config . instance_variable_get ( :@vi_cmd_mode_string )
205+ assert_equal '(cmd)' , get_config_variable ( :@vi_cmd_mode_string )
202206 end
203207
204208 def test_if_with_false
@@ -210,7 +214,7 @@ def test_if_with_false
210214 $endif
211215 LINES
212216
213- assert_equal '[cmd]' , @config . instance_variable_get ( :@vi_cmd_mode_string )
217+ assert_equal '[cmd]' , get_config_variable ( :@vi_cmd_mode_string )
214218 end
215219
216220 def test_if_with_indent
@@ -224,7 +228,7 @@ def test_if_with_indent
224228 $endif
225229 LINES
226230
227- assert_equal '(cmd)' , @config . instance_variable_get ( :@vi_cmd_mode_string )
231+ assert_equal '(cmd)' , get_config_variable ( :@vi_cmd_mode_string )
228232 end
229233 end
230234
@@ -446,7 +450,7 @@ def test_history_size
446450 set history-size 5000
447451 LINES
448452
449- assert_equal 5000 , @config . instance_variable_get ( :@history_size )
453+ assert_equal 5000 , get_config_variable ( :@history_size )
450454 history = Reline ::History . new ( @config )
451455 history << "a\n "
452456 assert_equal 1 , history . size
@@ -477,7 +481,7 @@ def test_inputrc_raw_value
477481 set vi-ins-mode-string aaa aaa
478482 set vi-cmd-mode-string bbb ccc # comment
479483 LINES
480- assert_equal :vi_insert , @config . instance_variable_get ( :@editing_mode_label )
484+ assert_equal :vi_insert , get_config_variable ( :@editing_mode_label )
481485 assert_equal 'aaa aaa' , @config . vi_ins_mode_string
482486 assert_equal 'bbb ccc # comment' , @config . vi_cmd_mode_string
483487 end
@@ -576,5 +580,9 @@ def test_reload
576580 File . write ( inputrc , "set emacs-mode-string ?" )
577581 @config . reload
578582 assert_equal '?' , @config . emacs_mode_string
583+
584+ File . write ( inputrc , "" )
585+ @config . reload
586+ assert_equal '@' , @config . emacs_mode_string
579587 end
580588end
0 commit comments