java.time Phase 2: Duration/Period, enums, ChronoUnit/Field machinery
Duration (ISO PT.. toString, between, full arithmetic), Period (between with borrow, P.. toString, normalized), full Month/DayOfWeek enums (named constants, print as their name — fixes the Phase-1 raw-jhost print), Year, YearMonth (2020-02 toString, leap, atDay/atEndOfMonth), ChronoUnit (between/getDuration) and ChronoField. The temporal machinery on the Phase-1 types now works with ChronoUnit/ChronoField: (.plus t n DAYS), (.until t1 t2 unit), (.get/.getLong t field), (.with t field v), (.isSupported ..), (.truncatedTo ..). Analyzer: (. Class method args) with a class target lowers to a static call (Class/method args) instead of mis-dispatching as an instance call on the arg — matches JVM; needed by cljc.java-time.year. Seed re-minted; selfhost holds. The Phase-2 cljc.java-time namespaces load; tick.core advances to a Phase-3 zone gap. 10 corpus rows certified vs JVM. make test + shakesmoke green, 0 new divergences, data.json stays 138/139.
This commit is contained in:
parent
c0561a8d14
commit
e3c14e656c
5 changed files with 773 additions and 17 deletions
|
|
@ -3011,4 +3011,16 @@
|
|||
{:suite "interop / java.time" :label "LocalDateTime toString" :expected "\"2020-01-15T10:30\"" :actual "(str (java.time.LocalDateTime/of 2020 1 15 10 30 0))"}
|
||||
{:suite "interop / java.time" :label "Instant ofEpochMilli toString" :expected "\"2020-01-15T10:30:00Z\"" :actual "(str (java.time.Instant/ofEpochMilli 1579084200000))"}
|
||||
{:suite "interop / java.time" :label "Instant ofEpochMilli round-trip" :expected "1579084200000" :actual "(.toEpochMilli (java.time.Instant/ofEpochMilli 1579084200000))"}
|
||||
{:suite "interop / java.time" :label "Duration ofSeconds toString" :expected "\"PT1M30S\"" :actual "(str (java.time.Duration/ofSeconds 90))"}
|
||||
{:suite "interop / java.time" :label "Duration between instants" :expected "\"PT1H1M1S\"" :actual "(str (java.time.Duration/between (java.time.Instant/ofEpochSecond 0) (java.time.Instant/ofEpochSecond 3661)))"}
|
||||
{:suite "interop / java.time" :label "Period between dates" :expected "\"P1Y2M2D\"" :actual "(str (java.time.Period/between (java.time.LocalDate/of 2020 1 1) (java.time.LocalDate/of 2021 3 3)))"}
|
||||
{:suite "interop / java.time" :label "Period parse round-trip" :expected "\"P1Y2M3D\"" :actual "(str (java.time.Period/parse \"P1Y2M3D\"))"}
|
||||
{:suite "interop / java.time" :label "Period normalized" :expected "\"P2Y1M5D\"" :actual "(str (.normalized (java.time.Period/of 1 13 5)))"}
|
||||
{:suite "interop / java.time" :label "Month of toString" :expected "\"FEBRUARY\"" :actual "(.toString (java.time.Month/of 2))"}
|
||||
{:suite "interop / java.time" :label "Month length leap" :expected "29" :actual "(.length (java.time.Month/of 2) true)"}
|
||||
{:suite "interop / java.time" :label "DayOfWeek constant prints name" :expected "\"MONDAY\"" :actual "(str java.time.DayOfWeek/MONDAY)"}
|
||||
{:suite "interop / java.time" :label "YearMonth toString" :expected "\"2020-02\"" :actual "(str (java.time.YearMonth/of 2020 2))"}
|
||||
{:suite "interop / java.time" :label "ChronoUnit DAYS between" :expected "14" :actual "(.between java.time.temporal.ChronoUnit/DAYS (java.time.LocalDate/of 2020 1 1) (java.time.LocalDate/of 2020 1 15))"}
|
||||
{:suite "interop / java.time" :label "LocalDate plus ChronoUnit DAYS" :expected "\"2020-01-04\"" :actual "(str (.plus (java.time.LocalDate/of 2020 1 1) 3 java.time.temporal.ChronoUnit/DAYS))"}
|
||||
{:suite "interop / java.time" :label "LocalDate until ChronoUnit DAYS" :expected "31" :actual "(.until (java.time.LocalDate/of 2020 1 1) (java.time.LocalDate/of 2020 2 1) java.time.temporal.ChronoUnit/DAYS)"}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue