Add a java.util.Locale shim (no-op default locale)
jolt's case ops are codepoint-based and locale-independent, so the default locale is a no-op token: getDefault/setDefault/forLanguageTag + ROOT/US/ENGLISH. honeysql sets and restores the locale around formatting to assert output is locale-stable (its Turkish-İ regression guard) — that test errored on the missing Locale/setDefault static, now passes (honeysql 635/8/1 -> 636/8/0).
This commit is contained in:
parent
135bad9d3a
commit
4df3d0fa34
1 changed files with 9 additions and 0 deletions
|
|
@ -149,6 +149,15 @@
|
||||||
(cons "parseShort" (lambda (x . r) (parse-int-or-throw x (if (null? r) 10 (jnum->exact (car r))) "parseShort")))
|
(cons "parseShort" (lambda (x . r) (parse-int-or-throw x (if (null? r) 10 (jnum->exact (car r))) "parseShort")))
|
||||||
(cons "toString" (lambda (x . r) (number->string (jnum->exact x))))))
|
(cons "toString" (lambda (x . r) (number->string (jnum->exact x))))))
|
||||||
|
|
||||||
|
;; java.util.Locale — jolt's case ops are codepoint-based (locale-independent), so
|
||||||
|
;; the default locale is a no-op token. Libraries set/restore it around formatting
|
||||||
|
;; to prove output is locale-stable (honeysql's Turkish-İ regression guard).
|
||||||
|
(register-class-statics! "Locale"
|
||||||
|
(list (cons "getDefault" (lambda () "und"))
|
||||||
|
(cons "setDefault" (lambda (x) jolt-nil))
|
||||||
|
(cons "forLanguageTag" (lambda (tag) (if (string? tag) tag (jolt-str-render-one tag))))
|
||||||
|
(cons "ROOT" "und") (cons "US" "en-US") (cons "ENGLISH" "en")))
|
||||||
|
|
||||||
(register-class-statics! "Boolean"
|
(register-class-statics! "Boolean"
|
||||||
(list (cons "parseBoolean" (lambda (s) (string=? "true" (ascii-string-down (if (string? s) s (jolt-str-render-one s))))))
|
(list (cons "parseBoolean" (lambda (s) (string=? "true" (ascii-string-down (if (string? s) s (jolt-str-render-one s))))))
|
||||||
(cons "TRUE" #t) (cons "FALSE" #f)))
|
(cons "TRUE" #t) (cons "FALSE" #f)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue