Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

Releases: capitalone/bash_shell_mock

v 1.3 - Support matching mocks against stdin.

04 Jan 13:14
c8dd45d
Compare
Choose a tag to compare

Release Notes:

  • Added support to define expectations using standard input
 shellmock_expect cat --status 0 --match-stdin "a b" --output "mock success"
  • Refactored shellmock_expect options to accomodate stdin and argument matching better.
  • Enhanced documentation updates.

1.2 - Better Support arguments with Whitespace

16 Oct 12:34
9e44da7
Compare
Choose a tag to compare

Overview

1.1 lacked support of quoted arguments when defining expectations and as a result it also introduced defects when using the partial mocking capability. 1.2 allows argument matchers to contain white space and supports the full range of match capabilities.

Compatibility

This update introduced non-compatibility when quoted args were previously used. Because of that I have introduced a new environment variable that will allow backward compatibility.

If you export SHELLMOCK_V1_COMPATIBILITY then you will get pre-1.2 behavior. The variable can be defined globally to cover all test cases or on a test case by test case basis.

Caveats

Because the shell itself eats the quotes, shellmock can not tell the difference between a single quote or a double quote so shellmock as opted to normalize and represent quoted arguments as double quotes. Therefore when verifying arguments, you should use the double-quote.

Additional samples were added to sample.sh and a new section in the read me covers the use of single and double quoted args.

Changes

  • README.adoc - Cleaned up the documentation and added new examples and section on whitespace in parameters.
  • shellmock - Added new feature to support whitespace.
  • sample.bats - Added examples for test cases with quoted args including partial mocks.
  • shellmock.bats - Added additional coverage for the various matching capabilities.

1.1 - RegEx Support

11 Sep 11:26
2865713
Compare
Choose a tag to compare

#Release Notes

##Changes

  • Added RegEx as a MTYPE. RegEx is implemented via AWK.
  • Various Documentation updates.
  • Update #!/bin/bash to be #!/usr/bin/env bash for portability.

1.0

12 Mar 13:03
9510913
Compare
Choose a tag to compare
1.0

Release Notes

This initial release of shellmock can be a useful comparison to the bats tool. It provides some ability to mock UNIX commands so that you can perform more comprehensive tests of utilities that might undesirably alter system state making tests difficult to repeat.

It has some constraints in that all commands being executed would need to be coming from the PATH vs hardcoded paths.

Features

  • Define expectations for any commands being used that allows you to control the expected behavior of the script.
  • Verify each mocked function to confirm complete commands that were executed.
  • Test cleanup functions
  • Mechanisms to debug an individual test