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

Migrating from V2 to V3 #56

Closed
jorgebucaran opened this issue Jan 12, 2021 · 4 comments
Closed

Migrating from V2 to V3 #56

jorgebucaran opened this issue Jan 12, 2021 · 4 comments
Labels
meta Announcements, migration guides, news

Comments

@jorgebucaran
Copy link
Owner

jorgebucaran commented Jan 12, 2021

Just upgraded to V3? You'll need to make some changes. In this issue, I'll explain what they are and how to migrate your tests.

  • Use (status dirname) instead of $current_dirname (needs Fish >=3.2).
  • Use (status filename) instead of $current_filename.
  • The test builtin ! operator is no longer supported.
    • Not to be confused with Fish ! operator.
  • @mesg is now @echo. Just s/@mesg/@echo/.
  • setup and teardown are no longer necessary (see Fishtape 3 #53).
    • The best way to do work before and after a test is simply right there in your test file.
  • Newlines in test arguments are no longer collapsed. Use echo or string collect:
    - @test "first six evens" (seq 2 2 12) = "2 4 6 8 10 12"
    + @test "first six evens" (echo (seq 2 2 12)) = "2 4 6 8 10 12"
    
    -@test "one two three" (seq 3) = "1
    +@test "one two three" (seq 3 | string collect) = "1
    2
    3"
@jorgebucaran jorgebucaran pinned this issue Jan 12, 2021
@edouard-lopez
Copy link
Contributor

Awesome, lots of new interesting stuff!

I'm wondering about (status dirname) as pure support Fish 3.0.2, we can't use this new syntax but the old one is gone. What should we do?

I use a lot setup and teardown in pure, it's going to be tedious to do the migration... I will probably keep them, just add a call to them

@jorgebucaran
Copy link
Owner Author

You can always use dirname:

dirname (status filename)

or cook something up with the string builtin.

set --local dirname (string split / --right --max=1 -- (status filename))[1]

I use a lot setup and teardown in pure, it's going to be tedious to do the migration... I will probably keep them, just add a call to them.

All you need to do is:

- function setup
  foobar
-end

-function teardown
-  piyopoyo
-end

@test ...
@test ...
@test ...

+ piyopoyo

@jorgebucaran jorgebucaran added the meta Announcements, migration guides, news label Jan 13, 2021
@PatrickF1
Copy link

Think you might of typo'ed. Or maybe you're from the wonderful future (please take me with you!), but fish 3.2 doesn't exist yet. Do you mean 3.1.2 is required for (status dirname)?

@jorgebucaran
Copy link
Owner Author

I am not from the future, but I did mean 3.2. You can use status dirname right now if you install Fish from the HEAD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Announcements, migration guides, news
Projects
None yet
Development

No branches or pull requests

3 participants