Skip to content

Testing framework: add a `no_mutation` attribute on `let`

E. Rivas requested to merge er433/test/no_mutation into dev

This MR introduces a new attribute for preventing mutation testing of mutating certain declarations. E.g.

// Two entrypoints
let add (store, delta : storage * int) : storage = store + delta
[@no_mutation] let sub (store, delta : storage * int) : storage = store - delta

(* Main access point that dispatches to the entrypoints according to
   the smart contract parameter. *)
let main (action, store : parameter * storage) : return =
 [@no_mutation] let _ = assert (0 = 0) in
 ([] : operation list),    // No operations
 (match action with
   Increment (n) -> add (store, n)
 | Decrement (n) -> sub (store, n))

both the assert (0 = 0) and the code in sub won't be mutated. This new attribute works in a similar way to @inline.

  • has a changelog entry
Edited by E. Rivas

Merge request reports

Loading