Skip to content

Commit 0ac854c

Browse files
TheHypnooproggeramlug
authored andcommitted
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 9944a4b commit 0ac854c

18 files changed

Lines changed: 908 additions & 256 deletions

test-coverage/COVERAGE.md

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

3-
Generated: 2026-05-13T16:03:36Z
3+
Generated: 2026-05-14T05:05:17Z
44

55
## Summary
66

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%)
7+
- **Total FFI functions:** 1791
8+
- **Covered by TypeScript fixtures:** 1791 (100.0%)
9+
- **Covered by Rust tests:** 1438 (80.3%)
10+
- **Covered by either TS or Rust:** 1791 (100.0%)
1111
- **Uncovered by either TS or Rust:** 0
1212

1313
## Coverage by File
@@ -41,7 +41,7 @@ Generated: 2026-05-13T16:03:36Z
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` | 80 | 80 | 80 | 80 | 100% | 100% |
44+
| `crates/perry-runtime/src/object.rs` | 81 | 81 | 81 | 81 | 100% | 100% |
4545
| `crates/perry-runtime/src/os.rs` | 29 | 29 | 29 | 29 | 100% | 100% |
4646
| `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% |

test-files/test_ffi_surface_runtime_core.ts

Lines changed: 2 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: 360 unique FFI names, 379 declarations.
9+
// Inventory entries: 359 unique FFI names, 378 declarations.
1010

1111
const testFfiSurfaceRuntimeCoreVersion = 1;
1212
if (testFfiSurfaceRuntimeCoreVersion !== 1) {
@@ -39,7 +39,6 @@ crates/perry-runtime/src/buffer.rs:
3939
- js_buffer_fill_random
4040
- js_buffer_print
4141
crates/perry-runtime/src/builtins.rs:
42-
- js_add
4342
- js_array_print
4443
- js_console_assert
4544
- js_console_assert_spread
@@ -88,7 +87,6 @@ crates/perry-runtime/src/builtins.rs:
8887
- js_queue_microtask
8988
- js_string_coerce
9089
- js_structured_clone
91-
- js_sub
9290
- js_text_decoder_decode
9391
- perry_debug_trace_init
9492
- perry_debug_trace_init_done
@@ -228,6 +226,7 @@ crates/perry-runtime/src/node_stream.rs:
228226
- js_node_stream_transform_new
229227
- js_node_stream_writable_new
230228
crates/perry-runtime/src/object.rs:
229+
- js_create_namespace
231230
- js_unresolved_default_call
232231
crates/perry-runtime/src/os.rs:
233232
- js_os_arch

test-files/test_ffi_surface_stdlib_core.ts

Lines changed: 1 addition & 247 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: 313 unique FFI names, 316 declarations.
9+
// Inventory entries: 84 unique FFI names, 85 declarations.
1010

1111
const testFfiSurfaceStdlibCoreVersion = 1;
1212
if (testFfiSurfaceStdlibCoreVersion !== 1) {
@@ -16,13 +16,6 @@ console.log("test_ffi_surface_stdlib_core: ok");
1616

1717
/*
1818
@covers
19-
crates/perry-stdlib/src/async_local_storage.rs:
20-
- js_async_local_storage_disable
21-
- js_async_local_storage_enter_with
22-
- js_async_local_storage_exit
23-
- js_async_local_storage_get_store
24-
- js_async_local_storage_new
25-
- js_async_local_storage_run
2619
crates/perry-stdlib/src/axios.rs:
2720
- js_axios_delete
2821
- js_axios_get
@@ -32,135 +25,12 @@ crates/perry-stdlib/src/axios.rs:
3225
- js_axios_response_data
3326
- js_axios_response_status
3427
- js_axios_response_status_text
35-
crates/perry-stdlib/src/commander.rs:
36-
- js_commander_action
37-
- js_commander_args_count
38-
- js_commander_command
39-
- js_commander_description
40-
- js_commander_get_arg
41-
- js_commander_get_option
42-
- js_commander_get_option_bool
43-
- js_commander_get_option_number
44-
- js_commander_name
45-
- js_commander_new
46-
- js_commander_option
47-
- js_commander_opts
48-
- js_commander_parse
49-
- js_commander_required_option
50-
- js_commander_version
5128
crates/perry-stdlib/src/common/dispatch.rs:
5229
- js_handle_method_dispatch
5330
- js_handle_property_set_dispatch
5431
- js_stdlib_init_dispatch
5532
crates/perry-stdlib/src/common/handle.rs:
5633
- js_handle_count
57-
crates/perry-stdlib/src/cron.rs:
58-
- js_cron_clear_interval
59-
- js_cron_clear_timeout
60-
- js_cron_describe
61-
- js_cron_job_is_running
62-
- js_cron_job_start
63-
- js_cron_job_stop
64-
- js_cron_next_date
65-
- js_cron_next_dates
66-
- js_cron_schedule
67-
- js_cron_set_interval
68-
- js_cron_set_timeout
69-
- js_cron_timer_has_pending
70-
- js_cron_timer_tick
71-
- js_cron_validate
72-
crates/perry-stdlib/src/dayjs.rs:
73-
- js_datefns_add_days
74-
- js_datefns_add_months
75-
- js_datefns_add_years
76-
- js_datefns_difference_in_days
77-
- js_datefns_difference_in_hours
78-
- js_datefns_difference_in_minutes
79-
- js_datefns_end_of_day
80-
- js_datefns_format
81-
- js_datefns_is_after
82-
- js_datefns_is_before
83-
- js_datefns_parse_iso
84-
- js_datefns_start_of_day
85-
- js_dayjs_add
86-
- js_dayjs_date
87-
- js_dayjs_day
88-
- js_dayjs_diff
89-
- js_dayjs_end_of
90-
- js_dayjs_format
91-
- js_dayjs_from_timestamp
92-
- js_dayjs_hour
93-
- js_dayjs_is_after
94-
- js_dayjs_is_before
95-
- js_dayjs_is_same
96-
- js_dayjs_is_valid
97-
- js_dayjs_millisecond
98-
- js_dayjs_minute
99-
- js_dayjs_month
100-
- js_dayjs_now
101-
- js_dayjs_parse
102-
- js_dayjs_second
103-
- js_dayjs_start_of
104-
- js_dayjs_subtract
105-
- js_dayjs_to_iso_string
106-
- js_dayjs_unix
107-
- js_dayjs_value_of
108-
- js_dayjs_year
109-
crates/perry-stdlib/src/decimal.rs:
110-
- js_decimal_abs
111-
- js_decimal_ceil
112-
- js_decimal_cmp
113-
- js_decimal_cmp_value
114-
- js_decimal_coerce_to_handle
115-
- js_decimal_div
116-
- js_decimal_div_number
117-
- js_decimal_div_value
118-
- js_decimal_eq
119-
- js_decimal_eq_value
120-
- js_decimal_floor
121-
- js_decimal_from_number
122-
- js_decimal_from_string
123-
- js_decimal_gt
124-
- js_decimal_gt_value
125-
- js_decimal_gte
126-
- js_decimal_gte_value
127-
- js_decimal_is_negative
128-
- js_decimal_is_positive
129-
- js_decimal_is_zero
130-
- js_decimal_lt
131-
- js_decimal_lt_value
132-
- js_decimal_lte
133-
- js_decimal_lte_value
134-
- js_decimal_minus
135-
- js_decimal_minus_number
136-
- js_decimal_minus_value
137-
- js_decimal_mod
138-
- js_decimal_mod_value
139-
- js_decimal_neg
140-
- js_decimal_plus
141-
- js_decimal_plus_number
142-
- js_decimal_plus_value
143-
- js_decimal_pow
144-
- js_decimal_round
145-
- js_decimal_sqrt
146-
- js_decimal_times
147-
- js_decimal_times_number
148-
- js_decimal_times_value
149-
- js_decimal_to_fixed
150-
- js_decimal_to_number
151-
- js_decimal_to_string
152-
crates/perry-stdlib/src/dotenv.rs:
153-
- js_dotenv_config
154-
- js_dotenv_config_path
155-
- js_dotenv_parse
156-
crates/perry-stdlib/src/events.rs:
157-
- js_event_emitter_emit
158-
- js_event_emitter_emit0
159-
- js_event_emitter_listener_count
160-
- js_event_emitter_new
161-
- js_event_emitter_on
162-
- js_event_emitter_remove_all_listeners
163-
- js_event_emitter_remove_listener
16434
crates/perry-stdlib/src/exponential_backoff.rs:
16535
- backOff
16636
- js_backoff_simple
@@ -203,90 +73,6 @@ crates/perry-stdlib/src/fastify/context.rs:
20373
crates/perry-stdlib/src/fastify/server.rs:
20474
- js_fastify_close
20575
- js_fastify_listen
206-
crates/perry-stdlib/src/lib.rs:
207-
- js_cron_timer_has_pending
208-
- js_cron_timer_tick
209-
crates/perry-stdlib/src/lodash.rs:
210-
- js_lodash_camel_case
211-
- js_lodash_capitalize
212-
- js_lodash_chunk
213-
- js_lodash_clamp
214-
- js_lodash_compact
215-
- js_lodash_concat
216-
- js_lodash_difference
217-
- js_lodash_drop
218-
- js_lodash_drop_right
219-
- js_lodash_fill
220-
- js_lodash_first
221-
- js_lodash_flatten
222-
- js_lodash_in_range
223-
- js_lodash_initial
224-
- js_lodash_is_empty
225-
- js_lodash_is_nil
226-
- js_lodash_kebab_case
227-
- js_lodash_last
228-
- js_lodash_lower_case
229-
- js_lodash_pad
230-
- js_lodash_pad_end
231-
- js_lodash_pad_start
232-
- js_lodash_random
233-
- js_lodash_range
234-
- js_lodash_repeat
235-
- js_lodash_reverse
236-
- js_lodash_size
237-
- js_lodash_snake_case
238-
- js_lodash_tail
239-
- js_lodash_take
240-
- js_lodash_take_right
241-
- js_lodash_times
242-
- js_lodash_trim
243-
- js_lodash_trim_end
244-
- js_lodash_trim_start
245-
- js_lodash_truncate
246-
- js_lodash_uniq
247-
- js_lodash_upper_case
248-
crates/perry-stdlib/src/lru_cache.rs:
249-
- js_lru_cache_clear
250-
- js_lru_cache_delete
251-
- js_lru_cache_get
252-
- js_lru_cache_has
253-
- js_lru_cache_new
254-
- js_lru_cache_peek
255-
- js_lru_cache_set
256-
- js_lru_cache_size
257-
crates/perry-stdlib/src/moment.rs:
258-
- js_moment_add
259-
- js_moment_clone
260-
- js_moment_date
261-
- js_moment_day
262-
- js_moment_diff
263-
- js_moment_end_of
264-
- js_moment_format
265-
- js_moment_from_now
266-
- js_moment_from_timestamp
267-
- js_moment_hour
268-
- js_moment_is_after
269-
- js_moment_is_before
270-
- js_moment_is_between
271-
- js_moment_is_same
272-
- js_moment_is_valid
273-
- js_moment_millisecond
274-
- js_moment_minute
275-
- js_moment_month
276-
- js_moment_now
277-
- js_moment_parse
278-
- js_moment_second
279-
- js_moment_start_of
280-
- js_moment_subtract
281-
- js_moment_to_date
282-
- js_moment_to_iso_string
283-
- js_moment_unix
284-
- js_moment_value_of
285-
- js_moment_year
286-
crates/perry-stdlib/src/nanoid.rs:
287-
- js_nanoid
288-
- js_nanoid_custom
289-
- js_nanoid_sized
29076
crates/perry-stdlib/src/perry_ffi_async.rs:
29177
- perry_ffi_promise_new
29278
- perry_ffi_promise_reject_bits
@@ -325,36 +111,4 @@ crates/perry-stdlib/src/sqlite.rs:
325111
- js_sqlite_stmt_raw
326112
- js_sqlite_stmt_run
327113
- js_sqlite_transaction
328-
crates/perry-stdlib/src/uuid.rs:
329-
- js_uuid_nil
330-
- js_uuid_v1
331-
- js_uuid_v4
332-
- js_uuid_v7
333-
- js_uuid_validate
334-
- js_uuid_version
335-
crates/perry-stdlib/src/validator.rs:
336-
- js_validator_contains
337-
- js_validator_equals
338-
- js_validator_is_alpha
339-
- js_validator_is_alphanumeric
340-
- js_validator_is_email
341-
- js_validator_is_empty
342-
- js_validator_is_float
343-
- js_validator_is_hexadecimal
344-
- js_validator_is_int
345-
- js_validator_is_json
346-
- js_validator_is_length
347-
- js_validator_is_length_min
348-
- js_validator_is_lowercase
349-
- js_validator_is_numeric
350-
- js_validator_is_uppercase
351-
- js_validator_is_url
352-
- js_validator_is_uuid
353-
crates/perry-stdlib/src/zlib.rs:
354-
- js_zlib_deflate_sync
355-
- js_zlib_gunzip
356-
- js_zlib_gunzip_sync
357-
- js_zlib_gzip
358-
- js_zlib_gzip_sync
359-
- js_zlib_inflate_sync
360114
*/

0 commit comments

Comments
 (0)