Language reference · section 28

28. Formatter

pin fmt gives every file one layout. It has no options.

Feature: Formatter

  Scenario: pin fmt formats a file in place
    Given any pin file
    When the author runs pin fmt file.pin
    Then the file is formatted in place

  Scenario: pin fmt --check fails when a file would change
    Given a file that is not formatted
    When the author runs pin fmt --check file.pin
    Then the command exits with 1

  Scenario: pin fmt - reads stdin and writes stdout
    Given text on stdin
    When the author runs pin fmt -
    Then the formatted text is written to stdout

  Scenario: The formatter refuses code that does not parse
    Given code with a syntax error
    When the author runs pin fmt
    Then the formatter does not change the file

  Scenario: The formatter does not change what the program means
    Given any file
    When the formatter runs
    Then the output has the same tokens and comments as the input

Layout rules:

message = "  pin is fun  "
  |> clean
  |> shout