Skip to content
Snippets Groups Projects

Testing framework: separate `Test.log` into printing and string conversion

Merged E. Rivas requested to merge er433/test/print+to_string into dev

type:added

For LIGO developers

The primitive Test.log is used to print in the console from the testing framework. However, this function does more than one thing: it converts a value to a string and it also prints the obtained string.

This MR separates these two functionalities. It also adds a way of calling OCaml's Scanf.unescape (but it's not exposed to the user), which allows to get strings from a nat [0, 255].

Changelog details:

New functions: Test.print, Test.println, Test.eprint, Test.to_string, Test.nl and Test.chr

These new functions provide more fine-grained printing.

val Test.print : string -> unit : prints an string to stdout.

val Test.println : string -> unit : prints an string to stdout, adding a newline at the end.

val Test.eprint : string -> unit : prints an string to stderr.

val Test.to_string : 'a -> string : turns a value of a given type into a string (internally using the same conversion as Test.log)

val Test.nl : string : a string containing only a newline.

Test.chr : nat -> string option : turns a nat in the range [0, 255] to an string consisting of only the corresponding char.

Edited by E. Rivas

Merge request reports

Merge train pipeline #571740967 passed with warnings

Merge train pipeline passed with warnings for 9008002b

Merged by E. RivasE. Rivas 2 years ago (Jun 23, 2022 11:43pm UTC)

Loading

Pipeline #571758895 passed

Pipeline: Ligo-Kubernetes-Infrastructure

#571773662

    Pipeline passed for 858f2bf4 on dev

    Activity

    Filter activity
    • Approvals
    • Assignees & reviewers
    • Comments (from bots)
    • Comments (from users)
    • Commits & branches
    • Edits
    • Labels
    • Lock status
    • Mentions
    • Merge request status
    • Tracking
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    Please register or sign in to reply
    Loading