Skip to main content

emit_suite_decls

Function emit_suite_decls 

Source
pub fn emit_suite_decls(
    types: &[TypeDecl],
    consts: &[ConstDecl],
    typed: &TypedCommons,
    qual: &HashMap<String, String>,
    runtime_use: &RuntimeUse,
) -> Vec<TsStmt>
Expand description

#3066: a suite’s own type and const declarations, as TypeScript for the body of one test runner: the types (an interface and its companion object, or a union), their JSON codecs (so select[T], Json.encode/decode and the boundary paths find __serialise_T / __deserialise_T in scope), and the constants (cached-function declarations, like a unit’s). They are declared local to the runner, so another suite declaring the same name cannot collide and nothing here reaches the deployable. typed is the suite’s view with the suite’s types and constants already merged in; qual qualifies a target type a suite type’s codec mentions, as the module-level codecs do.

Returns the statements with the export modifiers dropped (a function-local declaration cannot carry one). The driver prints them, at its own test-harness boundary.