HS: as Date/Set/Map return real JS host objects (+4 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
- hs-coerce "Date": new case returns (host-new "Date" value) - hs-coerce "Set": creates real JS Set via host-new + for-each add (was SX list) - hs-coerce "Map": creates real JS Map via host-new + for-each set (was SX list) - hs-make "Set"/"Map": use host-new instead of (list)/(dict) - hs-add-to!, hs-remove-from!, hs-empty-like, hs-append: handle real JS Sets - hs-run-filtered.js: add hs-is-set? and hs-is-map? natives - generator: MANUAL_TEST_BODIES for converts-as-Date (×2), as-Set, as-Map asExpression suite: 36/42 (was 32/42) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -326,6 +326,26 @@ MANUAL_TEST_BODIES = {
|
||||
' (list (list (quote record) record)))',
|
||||
' "<div age=\\"21\\" style=\\"color:bleaux\\">John Connor</div>"))',
|
||||
],
|
||||
# asExpression: Date/Set/Map need real JS host objects
|
||||
"converts value as Date": [
|
||||
' (let ((_result (eval-hs "1 as Date")))',
|
||||
' (assert= (host-call _result "getTime") 1))',
|
||||
],
|
||||
"can use the a modifier if you like": [
|
||||
' (let ((_result (eval-hs "1 as a Date")))',
|
||||
' (assert= (host-call _result "getTime") 1))',
|
||||
],
|
||||
"converts array as Set": [
|
||||
' (let ((_result (eval-hs "[1,2,2,3] as Set")))',
|
||||
' (assert (hs-is-set? _result))',
|
||||
' (assert= (host-get _result "size") 3))',
|
||||
],
|
||||
"converts object as Map": [
|
||||
' (let ((_result (eval-hs "{a:1, b:2} as Map")))',
|
||||
' (assert (hs-is-map? _result))',
|
||||
' (assert= (host-call _result "get" "a") 1)',
|
||||
' (assert= (host-get _result "size") 2))',
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user