File tree Expand file tree Collapse file tree 4 files changed +276
-203
lines changed
docs/site/content/zh/latest/tasks Expand file tree Collapse file tree 4 files changed +276
-203
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ items:
1212 {
1313 "count": 1,
1414 "items": [{
15- "title": "fix: there is a bug on page {{ randEnum "one" }}",
15+ "title": "fix: there is a bug on page {{ randEnum "one" "two" "three" "four" }}",
1616 "number": {{randInt 100 199}},
1717 "float": {{randFloat 0.0 1.0}},
18+ "status": "{{randWeightEnum (weightObject 4 "open") (weightObject 1 "closed")}}",
1819 "message": "{{.Response.Header.server}}",
19- "author": "someone",
20- "status": "success",
20+ "author": "{{env "USER"}}",
2121 "created": "{{ now.Format "2006-01-02T15:04:05Z07:00" }}"
2222 }],
2323 "uptime": "{{uptime}}"
Original file line number Diff line number Diff line change @@ -10,4 +10,28 @@ title = "用例模板"
1010
1111```
1212182{{shuffle "09876543"}}
13- ```
13+ ```
14+
15+ ## 带权重的随机枚举
16+
17+ 下面的代码以 80% 的概率返回 ` open ` ,以 20% 的概率返回 ` closed ` :
18+
19+ ```
20+ {{randWeightEnum (weightObject 4 "open") (weightObject 1 "closed")}}
21+ ```
22+
23+ ## 时间
24+
25+ 下面的代码可以生成当前时间,并制定时间格式:
26+
27+ ```
28+ {{ now.Format "2006-01-02T15:04:05Z07:00" }}
29+ ```
30+
31+ ## 环境变量
32+
33+ 下面的代码可以获取环境变量 ` SHELL ` 的值,在需要使用一个全局变量的时候,可以使用这个模板函数:
34+
35+ ```
36+ {{ env "SHELL" }}
37+ ```
You can’t perform that action at this time.
0 commit comments