Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lutzmad opened this issue Jan 30, 2024 · 1 comment
Open

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

lutzmad opened this issue Jan 30, 2024 · 1 comment

Comments

@lutzmad
Copy link

lutzmad commented Jan 30, 2024

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

@lutzmad
Copy link
Author

lutzmad commented May 15, 2024

An other ticket with a similar problem, see #289
Lutz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant