Skip to content

Commit

Permalink
test windows: add more check
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Mar 18, 2024
1 parent 228fdcf commit bf44393
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/test_detect_general.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ class TestDetectGeneral < Test::Unit::TestCase
def setup
Locale.init
Locale.clear_all
if Locale::Driver.const_defined?(:Win32)
@have_win32_driver =
(Locale::Driver.const_defined?(:Win32) and
Locale::Driver::Win32.respond_to?(:set_thread_locale_id))
if @have_win32_driver
Locale::Driver::Win32.set_thread_locale_id(0xffff) # invalid
end
ENV["LC_ALL"] = nil
Expand All @@ -38,7 +41,7 @@ def setup
end

def teardown
if Locale::Driver.const_defined?(:Win32)
if @have_win32_driver
Locale::Driver::Win32.set_thread_locale_id(nil)
end
end
Expand Down

0 comments on commit bf44393

Please sign in to comment.