Skip to content

Commit e91843e

Browse files
committed
test(stdlib): #696 — behavioral parity tests for stdlib core utilities
Convert the stdlib-core FFI inventory entries listed in #696 into focused behavioral parity fixtures and absorb the corresponding FFI symbols via @Covers blocks so regen_ts_surface_inventory.py removes them from the inventory. New fixtures (test-files/test_parity_*.ts): lodash, dotenv, validator, uuid, nanoid, decimal, dayjs, moment, date_fns, lru_cache, commander, cron, async_local_storage Existing fixtures extended with @Covers blocks: test_parity_events.ts, test_parity_zlib.ts Non-deterministic surfaces (uuid v4/v7, nanoid, dayjs.now, fromNow) use shape checks; everything else uses fixed inputs and anchored timestamps so the printed output is byte-deterministic. After regen, test_ffi_surface_stdlib_core.ts drops from 313 → 84 unique FFI names (all areas listed in #696 are converted). ./test-coverage/ audit.sh --markdown still reports 1790/1790 (100.0%) TS coverage.
1 parent 209ba11 commit e91843e

18 files changed

Lines changed: 930 additions & 260 deletions

test-coverage/COVERAGE.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Perry FFI Test Coverage
22

3-
Generated: 2026-05-11T17:05:37Z
3+
Generated: 2026-05-13T15:52:20Z
44

55
## Summary
66

7-
- **Total FFI functions:** 1771
8-
- **Covered by TypeScript fixtures:** 1771 (100.0%)
9-
- **Covered by Rust tests:** 1430 (80.7%)
10-
- **Covered by either TS or Rust:** 1771 (100.0%)
7+
- **Total FFI functions:** 1790
8+
- **Covered by TypeScript fixtures:** 1790 (100.0%)
9+
- **Covered by Rust tests:** 1437 (80.3%)
10+
- **Covered by either TS or Rust:** 1790 (100.0%)
1111
- **Uncovered by either TS or Rust:** 0
1212

1313
## Coverage by File
@@ -16,7 +16,7 @@ Generated: 2026-05-11T17:05:37Z
1616
|------|-------|------------|--------------|----------|-------------|-------------------|
1717
| `crates/perry-runtime/src/arena.rs` | 4 | 4 | 4 | 4 | 100% | 100% |
1818
| `crates/perry-runtime/src/arkts_callbacks.rs` | 8 | 8 | 3 | 8 | 100% | 100% |
19-
| `crates/perry-runtime/src/array.rs` | 74 | 74 | 74 | 74 | 100% | 100% |
19+
| `crates/perry-runtime/src/array.rs` | 77 | 77 | 77 | 77 | 100% | 100% |
2020
| `crates/perry-runtime/src/bigint.rs` | 28 | 28 | 28 | 28 | 100% | 100% |
2121
| `crates/perry-runtime/src/box.rs` | 3 | 3 | 0 | 3 | 100% | 100% |
2222
| `crates/perry-runtime/src/buffer.rs` | 77 | 77 | 77 | 77 | 100% | 100% |
@@ -41,12 +41,12 @@ Generated: 2026-05-11T17:05:37Z
4141
| `crates/perry-runtime/src/media_playback.rs` | 15 | 15 | 0 | 15 | 100% | 100% |
4242
| `crates/perry-runtime/src/net.rs` | 11 | 11 | 11 | 11 | 100% | 100% |
4343
| `crates/perry-runtime/src/node_stream.rs` | 6 | 6 | 1 | 6 | 100% | 100% |
44-
| `crates/perry-runtime/src/object.rs` | 77 | 77 | 77 | 77 | 100% | 100% |
44+
| `crates/perry-runtime/src/object.rs` | 80 | 80 | 80 | 80 | 100% | 100% |
4545
| `crates/perry-runtime/src/os.rs` | 29 | 29 | 29 | 29 | 100% | 100% |
46-
| `crates/perry-runtime/src/path.rs` | 13 | 13 | 6 | 13 | 100% | 100% |
46+
| `crates/perry-runtime/src/path.rs` | 16 | 16 | 6 | 16 | 100% | 100% |
4747
| `crates/perry-runtime/src/plugin.rs` | 22 | 22 | 22 | 22 | 100% | 100% |
4848
| `crates/perry-runtime/src/process.rs` | 4 | 4 | 0 | 4 | 100% | 100% |
49-
| `crates/perry-runtime/src/promise.rs` | 34 | 34 | 22 | 34 | 100% | 100% |
49+
| `crates/perry-runtime/src/promise.rs` | 36 | 36 | 22 | 36 | 100% | 100% |
5050
| `crates/perry-runtime/src/proxy.rs` | 19 | 19 | 1 | 19 | 100% | 100% |
5151
| `crates/perry-runtime/src/regex.rs` | 19 | 19 | 19 | 19 | 100% | 100% |
5252
| `crates/perry-runtime/src/set.rs` | 11 | 11 | 11 | 11 | 100% | 100% |
@@ -56,7 +56,7 @@ Generated: 2026-05-11T17:05:37Z
5656
| `crates/perry-runtime/src/symbol.rs` | 16 | 16 | 8 | 16 | 100% | 100% |
5757
| `crates/perry-runtime/src/text.rs` | 4 | 4 | 0 | 4 | 100% | 100% |
5858
| `crates/perry-runtime/src/thread.rs` | 5 | 5 | 3 | 5 | 100% | 100% |
59-
| `crates/perry-runtime/src/timer.rs` | 17 | 17 | 9 | 17 | 100% | 100% |
59+
| `crates/perry-runtime/src/timer.rs` | 18 | 18 | 10 | 18 | 100% | 100% |
6060
| `crates/perry-runtime/src/tty.rs` | 8 | 8 | 8 | 8 | 100% | 100% |
6161
| `crates/perry-runtime/src/tui/ffi.rs` | 32 | 32 | 30 | 32 | 100% | 100% |
6262
| `crates/perry-runtime/src/tui/hooks.rs` | 26 | 26 | 26 | 26 | 100% | 100% |
@@ -69,6 +69,7 @@ Generated: 2026-05-11T17:05:37Z
6969
| `crates/perry-runtime/src/value.rs` | 54 | 54 | 54 | 54 | 100% | 100% |
7070
| `crates/perry-runtime/src/watchos_game_loop.rs` | 2 | 2 | 1 | 2 | 100% | 100% |
7171
| `crates/perry-runtime/src/weakref.rs` | 15 | 15 | 1 | 15 | 100% | 100% |
72+
| `crates/perry-runtime/src/webassembly.rs` | 7 | 7 | 0 | 7 | 100% | 100% |
7273
| `crates/perry-stdlib/src/argon2.rs` | 5 | 5 | 2 | 5 | 100% | 100% |
7374
| `crates/perry-stdlib/src/async_local_storage.rs` | 6 | 6 | 5 | 6 | 100% | 100% |
7475
| `crates/perry-stdlib/src/axios.rs` | 8 | 8 | 8 | 8 | 100% | 100% |

test-files/test_ffi_surface_runtime_core.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// inventory into behavioral tests as each area gets deeper compatibility
77
// coverage.
88
//
9-
// Inventory entries: 915 unique FFI names, 934 declarations.
9+
// Inventory entries: 930 unique FFI names, 949 declarations.
1010

1111
const testFfiSurfaceRuntimeCoreVersion = 1;
1212
if (testFfiSurfaceRuntimeCoreVersion !== 1) {
@@ -40,6 +40,7 @@ crates/perry-runtime/src/array.rs:
4040
- js_array_find_last_index
4141
- js_array_flat
4242
- js_array_flatMap
43+
- js_array_flat_depth
4344
- js_array_forEach
4445
- js_array_from_f64
4546
- js_array_from_jsvalue
@@ -78,6 +79,8 @@ crates/perry-runtime/src/array.rs:
7879
- js_array_values
7980
- js_array_with
8081
- js_iterator_to_array
82+
- js_tagged_template_register_raw
83+
- js_template_raw
8184
crates/perry-runtime/src/bigint.rs:
8285
- js_bigint_add
8386
- js_bigint_and
@@ -189,7 +192,6 @@ crates/perry-runtime/src/buffer.rs:
189192
- js_uint8array_new
190193
- js_value_to_string_with_encoding
191194
crates/perry-runtime/src/builtins.rs:
192-
- js_add
193195
- js_array_print
194196
- js_console_assert
195197
- js_console_assert_spread
@@ -239,7 +241,6 @@ crates/perry-runtime/src/builtins.rs:
239241
- js_queue_microtask
240242
- js_string_coerce
241243
- js_structured_clone
242-
- js_sub
243244
- js_text_decoder_decode
244245
- perry_debug_trace_init
245246
- perry_debug_trace_init_done
@@ -573,6 +574,7 @@ crates/perry-runtime/src/object.rs:
573574
- js_register_handle_method_dispatch
574575
- js_register_handle_property_dispatch
575576
- js_register_handle_property_set_dispatch
577+
- js_unresolved_default_call
576578
- js_unresolved_namespace_stub
577579
- js_value_to_object
578580
- perry_key_content_hash
@@ -613,11 +615,14 @@ crates/perry-runtime/src/path.rs:
613615
- js_path_format
614616
- js_path_is_absolute
615617
- js_path_join
618+
- js_path_matches_glob
616619
- js_path_normalize
617620
- js_path_parse
618621
- js_path_relative
619622
- js_path_resolve
623+
- js_path_resolve_join
620624
- js_path_sep_get
625+
- js_path_to_namespaced_path
621626
crates/perry-runtime/src/plugin.rs:
622627
- perry_plugin_count
623628
- perry_plugin_discover
@@ -647,9 +652,11 @@ crates/perry-runtime/src/process.rs:
647652
crates/perry-runtime/src/promise.rs:
648653
- js_array_from_async
649654
- js_assimilate_thenable
655+
- js_async_first_call
650656
- js_async_step_chain
651657
- js_async_step_done
652658
- js_await_any_promise
659+
- js_get_current_step_closure
653660
- js_is_promise
654661
- js_iter_result_get_done
655662
- js_iter_result_get_value
@@ -839,6 +846,7 @@ crates/perry-runtime/src/timer.rs:
839846
- js_interval_timer_tick
840847
- js_set_timeout
841848
- js_set_timeout_callback
849+
- js_set_timeout_callback_args
842850
- js_set_timeout_value
843851
- js_sleep_ms
844852
- js_timer_has_pending
@@ -974,4 +982,12 @@ crates/perry-runtime/src/weakref.rs:
974982
- js_weakset_delete
975983
- js_weakset_has
976984
- js_weakset_new
985+
crates/perry-runtime/src/webassembly.rs:
986+
- js_webassembly_call_export_0
987+
- js_webassembly_call_export_1
988+
- js_webassembly_call_export_2
989+
- js_webassembly_call_export_3
990+
- js_webassembly_call_export_4
991+
- js_webassembly_instantiate
992+
- js_webassembly_validate
977993
*/

0 commit comments

Comments
 (0)