Add java.util.Optional (#241)
A value class libraries return from getters (java.time, and the java.net.http client shim that aws-api's java backend builds on). Statics of/ofNullable/empty, methods isPresent/isEmpty/get/orElse/orElseGet/ifPresent/toString, value-equal so (= (Optional/of x) (Optional/of x)). Five JVM-certified corpus rows. Runtime .ss, no re-mint. Co-authored-by: Yogthos <yogthos@gmail.com>
This commit is contained in:
parent
27d99db4bc
commit
301cda2e46
2 changed files with 32 additions and 0 deletions
|
|
@ -560,6 +560,11 @@
|
|||
{:suite "interop / java.time chrono-fields" :label "YearMonth PROLEPTIC_MONTH" :expected "24244" :actual "(.getLong (java.time.YearMonth/of 2020 5) java.time.temporal.ChronoField/PROLEPTIC_MONTH)"}
|
||||
{:suite "interop / java.time chrono-fields" :label "ISO_OFFSET_DATE_TIME keeps fractional seconds" :expected "1594033153417" :actual "(.toEpochMilli (.toInstant (java.time.ZonedDateTime/parse \"2020-07-06T10:59:13.417Z\" java.time.format.DateTimeFormatter/ISO_OFFSET_DATE_TIME)))"}
|
||||
{:suite "interop / java.time chrono-fields" :label "ISO_OFFSET_DATE_TIME without fraction" :expected "1594033153000" :actual "(.toEpochMilli (.toInstant (java.time.ZonedDateTime/parse \"2020-07-06T10:59:13Z\" java.time.format.DateTimeFormatter/ISO_OFFSET_DATE_TIME)))"}
|
||||
{:suite "interop / java.util Optional" :label "of + get" :expected "42" :actual "(.get (java.util.Optional/of 42))"}
|
||||
{:suite "interop / java.util Optional" :label "empty isPresent" :expected "false" :actual "(.isPresent (java.util.Optional/empty))"}
|
||||
{:suite "interop / java.util Optional" :label "value equality" :expected "true" :actual "(= (java.util.Optional/of 5) (java.util.Optional/of 5))"}
|
||||
{:suite "interop / java.util Optional" :label "empty orElse" :expected "7" :actual "(.orElse (java.util.Optional/empty) 7)"}
|
||||
{:suite "interop / java.util Optional" :label "ofNullable nil is empty" :expected "true" :actual "(= (java.util.Optional/empty) (java.util.Optional/ofNullable nil))"}
|
||||
{:suite "interop / java.time shims" :label "Instant/now is current" :expected "true" :actual "(> (.toEpochMilli (Instant/now)) 1500000000000)"}
|
||||
{:suite "interop / java.time shims" :label "sql types are not" :expected "false" :actual "(instance? java.sql.Timestamp #inst \"2020-01-01T00:00:00Z\")"}
|
||||
{:suite "interop / StringReader & StringBuilder" :label "StringReader read" :expected "[97 98 -1]" :actual "(let [r (java.io.StringReader. \"ab\")] [(.read r) (.read r) (.read r)])"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue