-
Notifications
You must be signed in to change notification settings - Fork 4
/
c0115.yml
134 lines (116 loc) · 3.18 KB
/
c0115.yml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
doc_meta: |
folder: call-func
title: sequence matters in return 2
head: |
This shows that the sequence of the return matters.
In this demo, when callee's var value is updated in its own stack or callee stack, the return cmd will return the updated value to caller
sections:
- title: Demo
log: yes
notes:
goal:
- demo a workflow using return in different cases
- the location of return cmd used could result in different result in parent vars scope
- this proves the design of local
vars:
tom: this is tom in global
jerry: this is jerry in global
tasks:
-
name: task
desc: main entry
task:
-
func: call
name: main task
desc: call subtask and exam the return value in following steps
do: subtask1
-
func: cmd
desc: |
check value of tom
in this case tom's value should come from subtask1
tom's expected value: tom created in subtask1
do:
- name: print
cmd: 'in main task print3: {{.tom}}'
-
name: subtask1
desc: subtask to test reg and return
task:
-
func: cmd
desc: check value of tom after it is registered in current task stack
vars:
john: john in sub_loop func1
do:
- name: reg
desc: by default hitom is registered in to global context
cmd:
name: tom
value: 'tom created in subtask1'
- name: print
cmd: 'in subtask1 print1: {{.tom}}'
-
func: cmd
desc: check value of tom and it should be available in current stack
vars:
john: john in sub_loop func2
do:
- name: print
cmd: 'in subtask1 print21: {{.tom}}'
-
func: call
desc: call subtask and exam the return value in following steps
do:
- subtask2
- subtask3
-
func: cmd
desc: check value of tom and it should be available in current stack
vars:
john: john in sub_loop func2
do:
- name: print
cmd: 'in subtask1 print22: {{.tom}}'
- name: return
cmd:
- tom
-
name: subtask2
desc: subtask to test reg and return
task:
-
func: cmd
desc: check value of tom after it is registered in current task stack
vars:
john: john in sub_loop func1
do:
- name: reg
desc: by default hitom is registered in to global context
cmd:
name: tom
value: 'tom2 created in subtask2'
- name: print
cmd: 'in subtask2 print1: {{.tom}}'
-
func: cmd
desc: check value of tom and it should be available in current stack
vars:
john: john in sub_loop func2
do:
- name: print
cmd: 'in subtask2 print2: {{.tom}}'
- name: return
cmd:
- tom
-
name: subtask3
desc: subtask3
task:
-
func: cmd
desc: dummy
do:
- name: print
cmd: 'dummy to help build inspect task'