Giter VIP home page Giter VIP logo

mockmaker's People

Contributors

d0han avatar florczakraf avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

florczakraf

mockmaker's Issues

Log all mock calls

Provide a way to log all calls of given mock along with timestamp and parameters.

missing shebang in generated mock

hi,

I noticed that shebang line is missing inside generated mock script (please examine below scenario). are you able to add it?

$ ./mock git --version
git version 2.1.0
exit code: 0
$ cat mocks/git 
# For param: --version
function p_cc86ec421cbdde13f944d2ff525ce9bc {
    echo "git version 2.1.0"
    >&2 echo ""
    exit 0
}

funame=p_$(echo -n "$@" | md5sum | cut -d" " -f1)
$funame
$ 

Tests failing on some hosts because 'cat' is mocked

./run_tests.sh
Running test_cat_mockmaker.sh test suite
Checking stdout..
Checking stderr..
Checking exitcode..

Running test_echo_special.sh test suite
Checking stdout..
Checking stderr..
Checking exitcode..

Running test_git_help.sh test suite
Checking stdout..
Checking stderr..
Checking exitcode..

Running test_git_thiswillfail.sh test suite
Checking stdout..
Checking stderr..
Checking exitcode..

Running test_git_version.sh test suite
Checking stdout..
Checking stderr..
Checking exitcode..

Running test_unknown_args.sh test suite
ERROR: ./cat test_unknown_args_stdout.txt is not mocked
ERROR: ./cat test_unknown_args_stderr.txt is not mocked
FAIL: stderr is empty
ERROR: Test failed: test_unknown_args.sh

Running test_unknown_command.sh test suite

Running shellcheck_test_mockmaker.sh test suite

Running shellcheck_test_mocks.sh test suite

Running shellcheck_test_tests.sh test suite

You can skip shellcheck tests with --skip-shellcheck

Mocked 'cat' is used instead of system one for test internals. This should not be the case.

improper quoting

mockmaker doesn't handle quoted names properly:

rf-> 'foo bar' qux
bazinga
(arya)[~/proj/mockmaker]
rf-> ./mockmaker 'foo bar' qux
stdout: 
stderr: ./mockmaker: line 74: foo: command not found
exit code: 127
(arya)[~/proj/mockmaker]
rf-> mocks/foo\ bar qux
./mockmaker: line 74: foo: command not found

errors while running mock without any parameters

hi,

some errors are visible while running mock without any parameters. I guess a little bit more advanced mechanism for parsing script's input parameters will be here needed:

[brand0m@helium mockmaker]$ ./mock
stdout: 
stderr: 
exit code: 0
mv: cannot move ‘mocks/’ to a subdirectory of itself, ‘mocks/_tmp’
./mock: line 33: mocks/: Is a directory
./mock: line 44: mocks/: Is a directory
rm: cannot remove ‘mocks/_tmp’: No such file or directory
[brand0m@helium mockmaker]$ echo $?
0
[brand0m@helium mockmaker]$ 

wrong output for unknown commands

hi,

let's assume that unknown_command is not available in the system:

[brand0m@helium mockmaker]$ unknown_command
bash: unknown_command: command not found
[brand0m@helium mockmaker]$ 

then let's try to mock that (yes, I know it's pointless to mock something which
is really not available)

[brand0m@helium mockmaker]$ ./mock unknown_command

exit code: 127
[brand0m@helium mockmaker]$

finally let's try to run mocked unknown_command:

[brand0m@helium mockmaker]$ ./mocks/unknown_command 

./mock: line 11: unknown_command: command not found
[brand0m@helium mockmaker]$ 

are you planning to unify output for such a cases?

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.