File tree Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,14 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1111Printf = " de0858da-6303-5e67-8744-51eddeeeb8d7"
1212RecipesBase = " 3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1313Serialization = " 9e88b42a-f829-5b0c-bbe9-9e923198166b"
14+ ShortStrings = " 63221d1c-8677-4ff0-9126-0ff0817b4975"
1415Unicode = " 4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
1516
1617[compat ]
1718EzXML = " 0.9.1, 1"
1819Mocking = " 0.7"
1920RecipesBase = " 0.7, 0.8, 1"
21+ ShortStrings = " 0.3.6"
2022julia = " 1"
2123
2224[extras ]
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ using Dates
44using Printf
55using Serialization
66using RecipesBase: RecipesBase, @recipe
7+ using ShortStrings: ShortString15
78using Unicode
89
910import Dates: TimeZone, UTC
Original file line number Diff line number Diff line change 1+ # Ideally would always use ShortString15, but it's `hash` is broken on 32-bit systems.
2+ # https://github.com/JuliaString/MurmurHash3.jl/issues/12
3+ const FixedTimeZoneName = Int === Int64 ? ShortString15 : String
4+
15const FIXED_TIME_ZONE_REGEX = r"""
26 ^(?|
37 Z
@@ -30,7 +34,7 @@ const FIXED_TIME_ZONE_REGEX = r"""
3034A `TimeZone` with a constant offset for all of time.
3135"""
3236struct FixedTimeZone <: TimeZone
33- name:: String
37+ name:: FixedTimeZoneName
3438 offset:: UTCOffset
3539end
3640
@@ -72,7 +76,7 @@ UTC+15:45:21
7276function FixedTimeZone (s:: AbstractString )
7377 s == " Z" && return UTC_ZERO
7478
75- m = match (FIXED_TIME_ZONE_REGEX, s )
79+ m = match (FIXED_TIME_ZONE_REGEX, String (s) )
7680 m === nothing && throw (ArgumentError (" Unrecognized time zone: $s " ))
7781
7882 coefficient = m[:sign ] == " -" ? - 1 : 1
Original file line number Diff line number Diff line change 4141 fixed_tz = FixedTimeZone (" UTC" )
4242 @test size (fixed_tz .== fixed_tz) == ()
4343 end
44+
45+ @testset " isbits" begin
46+ # We are not using ShortStrings on 32-bit due to hash being broken on 32-bit.
47+ # See https://github.com/JuliaString/MurmurHash3.jl/issues/12
48+ if Int === Int64
49+ @test isbits (FixedTimeZone (" 0123" ))
50+ else
51+ @test_broken isbits (FixedTimeZone (" 0123" ))
52+ end
53+ end
4454end
You can’t perform that action at this time.
0 commit comments