Skip to content

Error when using specific words inside 'equal' statement #343

Description

@Da-Buche

Hi,
When using 'equal', if the matched string is spanned over several lines, then some keywords cannot be used after newline.
Keywords are : It/Example/Specify/Todo

Setup:

> shellspec --version
0.28.1

EDIT:
I made something way easier to reproduce.
It seems the 'word' (or anything else) after 'Example' is important as 'Example' alone doesn't crash.

crash_spec.sh

#!/bin/bash
Describe 'crash'

It 'crashes shellspec'
When run echo test
The stdout should be blank
The stderr should equal '
Example word'
The status should be failure
End


End

> shellspec
/bin/sh: line 73: unexpected EOF while looking for matching `''

Unexpected error occurred (syntax error?) occurred in 'spec/crash_spec.sh'
Running: /bin/sh [bash 4.2.46(2)-release]


Finished in 0.39 seconds (user 0.30 seconds, sys 0.02 seconds)
0 examples, 0 failures, aborted by an unexpected error

Aborted with status code [executor: 1] [reporter: 1] [error handler: 102]
Fatal error occurred, terminated with exit status 102.

explicit_failure_spec.sh

#!/bin/bash
Describe 'explicit_failure'


It 'fails with explicit message'
When run echo test
The stdout should be blank
The stderr should equal '
Example word'
## The stderr should equal '
## Example word'
The status should be failure
End


End
> shellspec
Running: /bin/sh [bash 4.2.46(2)-release]
F

Examples:
  1) explicit_failure fails with explicit message
     When run echo test

     1.1) The stdout should be blank

            expected: blank (unset or zero length string)
                 got: "test"

          # spec/explicit_failure_spec.sh:7

     1.2) The stderr should equal
shellspec_abort 102 "Syntax error: It/Example/Specify/Todo cannot be defined inside of Example in spec/explicit_failure_spec.sh line 9" "" 2>&3
## The stderr should equal

            expected: "
            shellspec_abort 102 "Syntax error: It/Example/Specify/Todo cannot be defined inside of Example in spec/explicit_failure_spec.sh line 9" "" 2>&3
            ## The stderr should equal "
                 got: ""

          # spec/explicit_failure_spec.sh:8

     1.3) The status should be failure

            expected: failure (non-zero)
                 got: success (zero) [status: 0]

          # spec/explicit_failure_spec.sh:12

Finished in 0.32 seconds (user 0.33 seconds, sys 0.03 seconds)
1 example, 1 failure


Failure examples / Errors: (Listed here affect your suite's status)

shellspec spec/explicit_failure_spec.sh:5 # 1) explicit_failure fails with explicit message FAILED

Any help is welcome
Thanks
Aurel

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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