Skip to content

Typo in the README.md, see "Intercepting" sample #310

@lutzmad

Description

@lutzmad

Hello,
there is a typo in the "Intercepting" sample in the README.md,
see https://github.com/shellspec/shellspec?tab=readme-ov-file#intercepting

The "today.sh" sample script use "begin" and "end", but in the "today_spec.sh" an intercept is defined for "begin" only.

Describe "today.sh"
  Intercept begin end
  __begin__() {
    now() { echo "2021-01-01 01:02:03"; }
  }
  __end__() {
    # The "run source" is run in a subshell, so you need to use "%preserve"
    # to preserve variables
    %preserve today
  }

  It "gets today's date"
    When run source ./today.sh
    The output should eq "Today is 2021-01-01"
    The variable today should eq "2021-01-01"
  End
End

Add "end" to the "Intercept begin" line and the variable "today" will be preserved.

Thanks for the nice and useful script test tool,
Lutz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions