Server IP : 66.29.132.122 / Your IP : 18.227.102.159 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/locale-2.1.4/test/ |
Upload File : |
require 'locale' require 'thread' require 'test/unit' class TestThread < Test::Unit::TestCase def setup Locale.init(:driver => :env) @mutex = Mutex.new end def invoke_thread(tag, sleep_time) Thread.start do @mutex.synchronize { ENV["LC_ALL"] = tag Locale.current } (1..10).each do |v| # puts "#{tag}: locale = #{Locale.current}" assert_equal tag, Locale.current.to_posix.to_s print "." $stdout.flush sleep sleep_time end Locale.clear # Clear this thread only. end end def test_thread th1 = invoke_thread("ja_JP.eucJP", 0.3) th2 = invoke_thread("zh_CN.UTF-8", 0.2) th3 = invoke_thread("en", 0.1) th1.join th2.join th3.join end end