Commit Graph

42 Commits (master)

Author SHA1 Message Date
Mike Gerwitz e2f011c71d
s/::/:/g function names
The Google coding standard that used `::' was cute and all, but without a
broader framework to surround it (which I do not have time for atm), it's
too much.  `:' seems just as reasonable as a namespace delimiter.
2017-05-10 01:10:23 -04:00
Mike Gerwitz 2845e64b74
Output hexdump comparisons on expect failure
* src/ (fail): Output xxd hexdump of std{in,out}.
  (bail): Output to stderr.
2017-04-19 01:59:15 -04:00
Mike Gerwitz a368e809a3
Support binary comparisons by `expect'
* src/
  (__spec_result): Remove variable.
  (__spec_outfile): Add variable.
  (expect): Write stdout to temporary file rather than storing in variable,
    which strips trailing whitespace and does not handle null bytes.
  (shspec::__handle-to): Use `$__spec_outpath'.
  Update copyright years.

* test/test-spec: Add tests for trailing whitespace and binary comparison.
2017-04-19 01:57:42 -04:00
Mike Gerwitz e87d2ff210
Corrected copyright in file headers
Apparently I cannot spell my last name.
2014-06-17 01:35:24 -04:00
Mike Gerwitz 961ebf0255 {_sstack-=>shspec::stack::_} 2014-06-13 21:34:42 -04:00
Mike Gerwitz aa9044cc97 Began move to shspec::* function naming
This is motivated by Google's shell coding standards and will reduce the
odds of a naming conflict with other functions (which, of course, would
cause terribly odd and difficult-to-find bugs, in both our system and

If this seems like it creates long, overly-verbose function names with no
relief in sight---you're right. I'll have a solution for that in a bit, as a
separate project. a part of my never-ending, growing heap of projects.
2014-06-13 21:34:42 -04:00
Mike Gerwitz 4572d0f636
Runner will now output failure filenames
This is temporary until a proper reporter can be created
2014-06-13 21:31:52 -04:00
Mike Gerwitz a116a4ac72 Environment expectations now permit omitting operator
Export expectations will only succeed/fail based on flag checks, whereas the
declare/set expectations will fail on value.
2014-06-13 21:29:38 -04:00
Mike Gerwitz 9045a3298b Added `exports` expectation 2014-06-13 21:29:38 -04:00
Mike Gerwitz 302977eb74 Refactored environment expectations to support grabbing flags 2014-06-13 21:29:38 -04:00
Mike Gerwitz 331a1161b2 Added `declare` as an alias for `set` expectation 2014-06-13 21:29:38 -04:00
Mike Gerwitz 7597677086 Added env var value expectation 2014-06-13 21:29:34 -04:00
Mike Gerwitz 61cedf54f0
.sh extension for included files
Motivated by Google's shell coding standards. This makes sense for
non-executable files.
2014-06-13 21:29:24 -04:00
Mike Gerwitz 58a3f75d05
run-spec will now set wd to spec dir
This removes sourcing complications
2014-06-09 22:39:30 -04:00
Mike Gerwitz 683c4cc691 Added `not' expectation
Simply negates the result of whatever expectation it is given
2014-05-15 00:45:49 -04:00
Mike Gerwitz 00cf01c27a Refactored _handle-to to eliminate global state
This allows for a more sane proxy implementation that is necessary for
expectations like `not', which will be shown in the next commit.
2014-05-15 00:42:47 -04:00
Mike Gerwitz d0e508c2f5 Extracted output expectations into separate source file 2014-05-14 00:28:08 -04:00
Mike Gerwitz 914dafc62a `match' handler now defined in terms of output abstraction
Consequently, now supports `on' clause.
2014-05-13 23:25:27 -04:00
Mike Gerwitz 8858a8dce3 `output' parsing refactoring to allow sharing logic
This will be needed for match and possibly other output-driven expectation
handlers in the future.
2014-05-13 23:12:29 -04:00
Mike Gerwitz dc5a5d8f0f
Corrected _proxy-to to accept variable shift length 2014-05-13 21:38:30 -04:00
Mike Gerwitz eb188fe477
Added docblocks for remaining core expectations 2014-05-13 20:31:56 -04:00
Mike Gerwitz 65f6a48fd3
Added `aok' silent tests 2014-05-13 01:25:26 -04:00
Mike Gerwitz 76e90de26d
Expectation handler no longer receives extra newline 2014-05-13 01:25:24 -04:00
Mike Gerwitz a59a09007b
Added `silent' expectation handler 2014-05-13 01:25:22 -04:00
Mike Gerwitz 1dcc0cd8d0
Added `be' support as an expectation handler
E.g. "to be silent".
2014-05-13 01:25:19 -04:00
Mike Gerwitz 7a1409f7af
Added missing "to" to failure message 2014-05-13 01:25:17 -04:00
Mike Gerwitz 18843d855a
`output' expectation handler using aok for PIPESTATUS check 2014-05-13 01:25:15 -04:00
Mike Gerwitz 63e229b027
Added aok utility function
The name is not intended to sound cute: it means "array okay".

Note that this also demonstrates the need for a silent check: `aok foo' will
fail, but will output an error.
2014-05-13 01:25:14 -04:00
Mike Gerwitz c899f9c170
`output' expectation handler now supports stdout
This requires a little bit of file descriptor wizardry, but works; I will
need to abstract it for other handlers that will need to do the same thing.
2014-05-13 01:25:12 -04:00
Mike Gerwitz 8389a1f539
File descriptor 99 is reserved for internal use
It should not, by convention, be used by any test cases; its opening here
will (presumably, at least) prevent the shell from automatically allocating
it for any file operations and subshells.
2014-05-13 01:25:10 -04:00
Mike Gerwitz e3ab1e400e
Added support for stderr param for expectation handlers
This is unfortunately one of the cleanest ways to implement this, since
stdout is piped to stdin of the handler; I did not want to rely on using a
file descriptor, because then you have to deal with issues of rewinding the
pointer for possible future uses, and other considerations.
2014-05-13 01:25:08 -04:00
Mike Gerwitz 4b07f88f55
fail procuedure will now output file:line
This is still temporary, but will aid in debugging until a reporter is
2014-05-11 21:47:56 -04:00
Mike Gerwitz 89a38a5dc2
Adjusted existing handlers and tests to honor shift argument
This will also ensure that the test cases do not break when new arguments
are added, since the existing conventions will remain unchanged.
2014-05-10 00:42:58 -04:00
Mike Gerwitz b3b3a9fcef
Added shift argument to expectation handlers
This allows the implementation to vary in the number of arguments provided
to the expectation handlers without breaking BC so long as the meanings of
the shifted arguments do not change.
2014-05-10 00:34:01 -04:00
Mike Gerwitz c1d1b66fa9
Added `match' expectation 2014-05-09 23:31:47 -04:00
Mike Gerwitz d2e8d21ac5
Initial `and' declaration support 2014-05-09 21:48:09 -04:00
Mike Gerwitz ca527165aa
Added _bail_clause shorthand
There will be a test for bailing on output's clause shortly, now that we can
assert on output...testing itself.
2014-05-09 02:15:09 -04:00
Mike Gerwitz 08e1d9c889
_bail will now default to current spec caller 2014-05-09 02:14:11 -04:00
Mike Gerwitz 61ecb6ad82
Added output expectation handler 2014-05-09 02:04:09 -04:00
Mike Gerwitz b4572d420b
Expectation premise output now piped to expectation handler 2014-05-09 01:59:21 -04:00
Mike Gerwitz 6dbf996f3b
Exit code now passed to expectation handlers 2014-05-09 01:13:26 -04:00
Mike Gerwitz 3d1f9d22a7
Initial concept and working tests for shspec
My original prototype was more feature-rich than this, but this formalizes
it and provides self-tests.

It is indeed odd seeing shell code that does not look like shell.
2014-05-09 00:58:06 -04:00