Giter VIP home page Giter VIP logo

Comments (4)

pawamoy avatar pawamoy commented on May 20, 2024

OK, seems to be because I used double-quotes for my test name instead of single-quotes. Is it mentioned in the README/docs?

I'm actually giving a try at zunit by migrating bats tests :)

from zunit.

molovo avatar molovo commented on May 20, 2024

@pawamoy it's not - I wasn't aware it was an issue. It should accept both so I'll look into a fix

from zunit.

MichaelAquilina avatar MichaelAquilina commented on May 20, 2024

Can confirm this also occurs on my own tests when swapping ' for "

from zunit.

pawamoy avatar pawamoy commented on May 20, 2024

I think it's caused by this line:

testname="${line[(( ${line[(i)[\']]}+1 )),(( ${line[(I)[\']]}-1 ))]}"

You are using \' to get the test name boundaries. When using double-quotes instead, the test name is empty, and then later at

tests[${#test_names}]=''

...you are trying to assign a value at index 0, when arrays start at 1 in Zsh, hence the error we get

_zunit_run_testfile:21: tests: assignment to invalid subscript range

Maybe a simple fix would be to use

-testname="${line[(( ${line[(i)[\']]}+1 )),(( ${line[(I)[\']]}-1 ))]}" 
+testname="${line[(( ${line[(i)[\'\"]]}+1 )),(( ${line[(I)[\'\"]]}-1 ))]}" 

instead? Not sure about the escaping, or if [] really are regex characters ranges.

from zunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.