@@ -69,6 +69,8 @@ def test_irb_info_multiline
69
69
IRB . conf [ :USE_MULTILINE ] = true
70
70
IRB . conf [ :USE_SINGLELINE ] = false
71
71
IRB . conf [ :VERBOSE ] = false
72
+ lang_backup = ENV . delete ( "LANG" )
73
+ lc_all_backup = ENV . delete ( "LC_ALL" )
72
74
workspace = IRB ::WorkSpace . new ( self )
73
75
irb = IRB ::Irb . new ( workspace , TestInputMethod . new ( [ ] ) )
74
76
IRB . conf [ :MAIN_CONTEXT ] = irb . context
@@ -80,6 +82,9 @@ def test_irb_info_multiline
80
82
RUBY_PLATFORM: .+
81
83
}x
82
84
assert_match expected , irb . context . main . irb_info . to_s
85
+ ensure
86
+ ENV [ "LANG" ] = lang_backup
87
+ ENV [ "LC_ALL" ] = lc_all_backup
83
88
end
84
89
85
90
def test_irb_info_singleline
@@ -89,6 +94,8 @@ def test_irb_info_singleline
89
94
IRB . conf [ :USE_MULTILINE ] = false
90
95
IRB . conf [ :USE_SINGLELINE ] = true
91
96
IRB . conf [ :VERBOSE ] = false
97
+ lang_backup = ENV . delete ( "LANG" )
98
+ lc_all_backup = ENV . delete ( "LC_ALL" )
92
99
workspace = IRB ::WorkSpace . new ( self )
93
100
irb = IRB ::Irb . new ( workspace , TestInputMethod . new ( [ ] ) )
94
101
IRB . conf [ :MAIN_CONTEXT ] = irb . context
@@ -100,6 +107,9 @@ def test_irb_info_singleline
100
107
RUBY_PLATFORM: .+
101
108
}x
102
109
assert_match expected , irb . context . main . irb_info . to_s
110
+ ensure
111
+ ENV [ "LANG" ] = lang_backup
112
+ ENV [ "LC_ALL" ] = lc_all_backup
103
113
end
104
114
105
115
def test_irb_info_multiline_without_rc_files
@@ -112,6 +122,8 @@ def test_irb_info_multiline_without_rc_files
112
122
IRB . conf [ :USE_MULTILINE ] = true
113
123
IRB . conf [ :USE_SINGLELINE ] = false
114
124
IRB . conf [ :VERBOSE ] = false
125
+ lang_backup = ENV . delete ( "LANG" )
126
+ lc_all_backup = ENV . delete ( "LC_ALL" )
115
127
workspace = IRB ::WorkSpace . new ( self )
116
128
irb = IRB ::Irb . new ( workspace , TestInputMethod . new ( [ ] ) )
117
129
IRB . conf [ :MAIN_CONTEXT ] = irb . context
@@ -127,6 +139,8 @@ def test_irb_info_multiline_without_rc_files
127
139
ENV [ "INPUTRC" ] = inputrc_backup
128
140
IRB . __send__ ( :remove_const , :IRBRC_EXT )
129
141
IRB . const_set ( :IRBRC_EXT , ext_backup )
142
+ ENV [ "LANG" ] = lang_backup
143
+ ENV [ "LC_ALL" ] = lc_all_backup
130
144
end
131
145
132
146
def test_irb_info_singleline_without_rc_files
@@ -139,6 +153,8 @@ def test_irb_info_singleline_without_rc_files
139
153
IRB . conf [ :USE_MULTILINE ] = false
140
154
IRB . conf [ :USE_SINGLELINE ] = true
141
155
IRB . conf [ :VERBOSE ] = false
156
+ lang_backup = ENV . delete ( "LANG" )
157
+ lc_all_backup = ENV . delete ( "LC_ALL" )
142
158
workspace = IRB ::WorkSpace . new ( self )
143
159
irb = IRB ::Irb . new ( workspace , TestInputMethod . new ( [ ] ) )
144
160
IRB . conf [ :MAIN_CONTEXT ] = irb . context
@@ -154,6 +170,37 @@ def test_irb_info_singleline_without_rc_files
154
170
ENV [ "INPUTRC" ] = inputrc_backup
155
171
IRB . __send__ ( :remove_const , :IRBRC_EXT )
156
172
IRB . const_set ( :IRBRC_EXT , ext_backup )
173
+ ENV [ "LANG" ] = lang_backup
174
+ ENV [ "LC_ALL" ] = lc_all_backup
175
+ end
176
+
177
+ def test_irb_info_lang
178
+ FileUtils . touch ( "#{ @tmpdir } /.inputrc" )
179
+ FileUtils . touch ( "#{ @tmpdir } /.irbrc" )
180
+ IRB . setup ( __FILE__ , argv : [ ] )
181
+ IRB . conf [ :USE_MULTILINE ] = true
182
+ IRB . conf [ :USE_SINGLELINE ] = false
183
+ IRB . conf [ :VERBOSE ] = false
184
+ lang_backup = ENV . delete ( "LANG" )
185
+ lc_all_backup = ENV . delete ( "LC_ALL" )
186
+ ENV [ "LANG" ] = "ja_JP.UTF-8"
187
+ ENV [ "LC_ALL" ] = "en_US.UTF-8"
188
+ workspace = IRB ::WorkSpace . new ( self )
189
+ irb = IRB ::Irb . new ( workspace , TestInputMethod . new ( [ ] ) )
190
+ IRB . conf [ :MAIN_CONTEXT ] = irb . context
191
+ expected = %r{
192
+ Ruby\s version: .+\n
193
+ IRB\s version:\s irb .+\n
194
+ InputMethod:\s Abstract\s InputMethod\n
195
+ \. irbrc\s path: .+\n
196
+ RUBY_PLATFORM: .+\n
197
+ LANG\s env:\s ja_JP\. UTF-8\n
198
+ LC_ALL\s env:\s en_US\. UTF-8\n
199
+ }x
200
+ assert_match expected , irb . context . main . irb_info . to_s
201
+ ensure
202
+ ENV [ "LANG" ] = lang_backup
203
+ ENV [ "LC_ALL" ] = lc_all_backup
157
204
end
158
205
159
206
def test_measure
0 commit comments