Merge pull request #45 from maths22/osx-big-sur

Support macos big sur
This commit is contained in:
Damian Nelson 2021-01-14 12:49:31 -08:00 committed by GitHub
commit 95ddb2fe54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 8 deletions

View File

@ -11,7 +11,3 @@ rvm:
before_script:
- sudo apt-get install -y libicu-dev
jobs:
allow_failures:
- rvm: 2.7
- rvm: ruby-head

View File

@ -39,7 +39,12 @@ module ICU
[find_lib("libicui18n.#{FFI::Platform::LIBSUFFIX}.??"),
find_lib("libicutu.#{FFI::Platform::LIBSUFFIX}.??")]
when :osx
[find_lib("libicucore.#{FFI::Platform::LIBSUFFIX}")]
# See https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes (62986286)
if Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('11')
["libicucore.#{FFI::Platform::LIBSUFFIX}"]
else
[find_lib("libicucore.#{FFI::Platform::LIBSUFFIX}")]
end
when :linux
[find_lib("libicui18n.#{FFI::Platform::LIBSUFFIX}.??"),
find_lib("libicutu.#{FFI::Platform::LIBSUFFIX}.??")]

View File

@ -77,7 +77,12 @@ module ICU
if Gem::Version.new('4.4') <= Gem::Version.new(Lib.version)
expect(Locale.new('en_US').to_language_tag).to eq('en-US')
expect(Locale.new('zh_TW').to_language_tag).to eq('zh-TW')
expect(Locale.new('zh_Hans_CH_PINYIN').to_language_tag).to eq('zh-Hans-CH-u-co-pinyin')
# Support for this "magic" transform was dropped with https://unicode-org.atlassian.net/browse/ICU-20187, so don't test it
if Gem::Version.new(Lib.version) < Gem::Version.new('64')
expect(Locale.new('zh_Hans_CH_PINYIN').to_language_tag).to eq('zh-Hans-CH-u-co-pinyin')
else
expect(Locale.new('zh_Hans_CH@collation=pinyin').to_language_tag).to eq('zh-Hans-CH-u-co-pinyin')
end
else
expect(Locale.new('en_US').to_language_tag).to eq('en-us')
expect(Locale.new('zh_TW').to_language_tag).to eq('zh-tw')

View File

@ -20,7 +20,7 @@ module ICU
end
it 'should format a decimal' do
expect(NumberFormatting.format_number("en", BigDecimal.new("10000.123"))).to eq("10,000.123")
expect(NumberFormatting.format_number("en", BigDecimal("10000.123"))).to eq("10,000.123")
end
it 'should format a currency' do
@ -54,7 +54,12 @@ module ICU
it 'should allow for various styles of currency formatting if the version is new enough' do
if ICU::Lib.version.to_a.first >= 53
curf = NumberFormatting.create('en-US', :currency, style: :iso)
expect(curf.format(1_000.12, 'USD')).to eq("USD1,000.12")
expected = if ICU::Lib.version.to_a.first >= 62
"USD\u00A01,000.12"
else
"USD1,000.12"
end
expect(curf.format(1_000.12, 'USD')).to eq(expected)
curf = NumberFormatting.create('en-US', :currency, style: :plural)
expect(curf.format(1_000.12, 'USD')).to eq("1,000.12 US dollars")
expect { NumberFormatting.create('en-US', :currency, style: :fake) }.to raise_error(StandardError)