-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpipeline.yaml
44 lines (39 loc) · 931 Bytes
/
pipeline.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: "Pipeline"
cases:
- name: "Basic pipe"
stdin: |
echo hi | grep -l h
- name: "Longer pipe"
stdin: |
echo hi | grep h | wc -l
- name: "Invert result"
stdin: |
! false
echo "! false: $?"
! true
echo "! true: $?"
- name: "Exit codes for piped commands"
test_files:
- path: "script.sh"
executable: true
contents: |
#!/bin/sh
(cat; echo -n "-> $1")
exit $1
stdin: |
./script.sh 10 | ./script.sh 0 | ./script.sh 33
- name: "Side effects in pipe commands"
stdin: |
var=0
echo "var: ${var}"
{ var=1; }
echo "var: ${var}"
{ var=2; echo hi; } | cat
echo "var: ${var}"
echo hi | { var=3; cat; }
echo "var: ${var}"
- name: "pipeline extension"
stdin: |
echo -e "hello" |& wc -l
cat dfdfgdfgdf |& wc -l
foo() { cat dfgdfg; } |& wc -l