Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
TDD #!/bin/bash
Slide 2
Slide 2 text
$ false $ echo $? 1 $ true $ echo $? 0 $ : $ echo $? 0
Slide 3
Slide 3 text
test
Slide 4
Slide 4 text
$ test -f ./missing $ echo $? 1 $ [ -f ./missing ] $ echo $? 1
Slide 5
Slide 5 text
[[ ]]
Slide 6
Slide 6 text
$ [[ foobar =~ bar ]] $ echo $? 0 $ [[ foobar =~ ^bar ]] $ echo $? 1
Slide 7
Slide 7 text
||
Slide 8
Slide 8 text
$ cf push &>/dev/null $ echo $? 1 $ cf push >&- || echo "Call 222333" Call 222333 $ echo $? 0
Slide 9
Slide 9 text
if
Slide 10
Slide 10 text
if cf push >&- then true else echo "Call 222333" fi if ! cf push >&- then echo "Call 222333" fi
Slide 11
Slide 11 text
The TDD Apostate1 1 Mark Seemann
Slide 12
Slide 12 text
TDD != good code
Slide 13
Slide 13 text
How to write good bash code?
Slide 14
Slide 14 text
github.com/gerhard/bash
Slide 15
Slide 15 text
The path to good bash code
Slide 16
Slide 16 text
Understand the bash pitfalls
Slide 17
Slide 17 text
Use shellcheck
Slide 18
Slide 18 text
Emphasise on functional code
Slide 19
Slide 19 text
Discover the simplest concepts
Slide 20
Slide 20 text
Explore their optimal composition
Slide 21
Slide 21 text
Stop when the fun stops
Slide 22
Slide 22 text
Contain that bash
Slide 23
Slide 23 text
Functional core, imperative shell2 2 Gary Bernhardt, Boundaries, SCNA & Ruby Conf 2012
Slide 24
Slide 24 text
Containers for integration testing
Slide 25
Slide 25 text
github.com/gerhard/bash