Code Monkey home page Code Monkey logo

Comments (2)

wbsch avatar wbsch commented on July 19, 2024

Hi Unode,

you didn't follow rule 1 of bash_tap.sh - "No multi-line Bash constructs".

Defining functions on multiple lines is fine in a helper script which you then include in your tests, so you could just add that function to your bash_tap_fd.sh helper.

If you really insist on defining functions in your tests, you'll have to do it like this:

$ cat foo.t 
#!/usr/bin/env bash
source bash_tap.sh

function nothinghere { echo "Hello world"; }
nothinghere | grep Hello
nothinghere | grep hcsvntdrcns

$ bash foo.t 
1..1
# $ function nothinghere { echo "Hello world"; }
# $ nothinghere | grep Hello
# >>> Hello world
# $ nothinghere | grep hcsvntdrcns
not ok 1 - nothinghere | grep hcsvntdrcns

And by the way, nice work taking this little abomination of a Bash script to places where it has no right to be! :)

from bash_tap.

unode avatar unode commented on July 19, 2024

Thanks for the clarification.
I'll use the bash_tap_fd.sh file for any future code reuse.

If only all "little abominations" out there managed to get the job done, the world... ;)

from bash_tap.

Related Issues (2)

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.