Skip to content

Conversation

@locochris
Copy link
Collaborator

Example usage:

  equality matcher
     1:     it "handles newlines properly"
     2:       string_with_newline_char="new
     3: line"
     4:       multiline_string='new
     5: line'
 =>  6:       pry
     7:       assert equal "$multiline_string" "$string_with_newline_char"
     8:     end
     9:
    10:     it "compares strings containing single quotes"
    11:       assert equal "a' b" "a' b"
[2] shpec-pry> echo "$multiline_string"
new
line
[2] shpec-pry> assert equal "1" "2"
    handles newlines properly
    (Expected [1] to equal [2])
[2] shpec-pry> assert equal "$multiline_string" "$string_with_newline_char"
    handles newlines properly

Example usage:
```
  equality matcher
     1:     it "handles newlines properly"
     2:       string_with_newline_char="new
     3: line"
     4:       multiline_string='new
     5: line'
 =>  6:       pry
     7:       assert equal "$multiline_string" "$string_with_newline_char"
     8:     end
     9:
    10:     it "compares strings containing single quotes"
    11:       assert equal "a' b" "a' b"
[2] shpec-pry> echo "$multiline_string"
new
line
[2] shpec-pry> assert equal "1" "2"
    handles newlines properly
    (Expected [1] to equal [2])
[2] shpec-pry> assert equal "$multiline_string" "$string_with_newline_char"
    handles newlines properly
```
@AdrieanKhisbe
Copy link
Collaborator

@locochris, I don't get what pry is supposed to do

@rylnd
Copy link
Owner

rylnd commented May 6, 2015

This seems really cool. Is there anything shpec-specific about it, though? This seems like a separate (albeit really useful) utility that we could recommend along with shpec (similar to entr).

@AdrieanKhisbe
Copy link
Collaborator

My bad. after a second reread, now i see perfectly the goal.

(I thought that w&as a reference to ruby repl, but I should look for a translation: http://dictionnaire.reverso.net/anglais-francais/pry
haha)

@locochris
Copy link
Collaborator Author

@rylnd - entr? - but yer perhaps a separate utility? I'm just finding it really useful when doing development driven testing (ie. lazily figuring out exactly how best to test what I've written by poking around in a subshell), so thought i'd chuck it up as a PR in case anyone also found it useful.

@rylnd
Copy link
Owner

rylnd commented May 7, 2015

@locochris entr was suggested in #45, and I promptly added it to the README. If you want to package this up, I'd love to do something similar. An alternative is to add some kind of "shpec recipes" section to the wiki, where we can share neat little tricks with entr or shpec-pry or whatever.

@rylnd
Copy link
Owner

rylnd commented May 7, 2015

If we could extract this to a shpec-pry function/executable, that one could install separately and then call from within a test (as above, but without modifying shpec itself), that seems like the ideal scenario.

@locochris, is that at all possible?

@hlangeveld
Copy link
Collaborator

On 05/07/15 20:35, Ryland Herrick wrote:

If we could extract this to a |shpec-pry| function/executable, that one could install separately and then call from within a test
(as above, but without modifying |shpec| itself), that seems like the ideal scenario.

@locochris https://github.com/locochris, is that at all possible?

As |pry| has to be a bash function, it would be easy to deliver it as an extension to anyone using shpec with bash,
and we should not stop that. However, it does depend strongly on the bash |caller| built-in, so it can't be loaded
run as an external command, nor would it work with any other of the shells we've tested so far.

Inconveniently, bash does not have a native function autoload feature, like ksh's FPATH, so shpec would need a way of
importing function definitions as extensions, just like we now add custom matcher functions.

Henk

@rylnd
Copy link
Owner

rylnd commented Apr 2, 2017

@locochris I'd like to make this a plugin (perhaps the first!); see #108 for details. I'm going to close this because it won't be merged to master. I've added a label here so that once #108 is ready we can take another pass at converting these to plugins.

@rylnd rylnd closed this Apr 2, 2017
@rylnd rylnd removed the in progress label Apr 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants