|
1 | 1 | {# Test macros #}
|
2 | 2 |
|
| 3 | +{# Waived value emojis in order of decreasing priority #} |
| 4 | +{% set WAIVED_EMOJIS = { |
| 5 | + false: "", |
| 6 | + true: "🚧", |
| 7 | + none: "❓", |
| 8 | + } %} |
| 9 | + |
| 10 | +{# Status value emojis in order of decreasing priority #} |
| 11 | +{% set STATUS_EMOJIS = { |
| 12 | + "FAIL": "❌", |
| 13 | + "ERROR": "💥", |
| 14 | + "PASS": "✅", |
| 15 | + "DONE": "🆗", |
| 16 | + "SKIP": "⏩", |
| 17 | + none: "❓", |
| 18 | + } %} |
| 19 | + |
| 20 | +{# Combined waived and status values emojis in order of decreasing priority #} |
| 21 | +{% set WAIVED_STATUS_EMOJIS = {} %} |
| 22 | +{% for waived, waived_emoji in WAIVED_EMOJIS.items() %} |
| 23 | + {% for status, status_emoji in STATUS_EMOJIS.items() %} |
| 24 | + {% set _ = WAIVED_STATUS_EMOJIS.__setitem__( |
| 25 | + (waived, status), waived_emoji + status_emoji |
| 26 | + ) %} |
| 27 | + {% endfor %} |
| 28 | +{% endfor %} |
| 29 | + |
3 | 30 | {% macro status_emoji(status) %}
|
4 |
| - {{- "💥" if status == "ERROR" else |
5 |
| - "❌" if status == "FAIL" else |
6 |
| - "✅" if status == "PASS" else |
7 |
| - "🆗" if status == "DONE" else |
8 |
| - "⏩" if status == "SKIP" else |
9 |
| - "❓" -}} |
| 31 | + {{- STATUS_EMOJI[status] -}} |
10 | 32 | {% endmacro %}
|
11 | 33 |
|
12 | 34 | {% macro waived_emoji(waived) %}
|
13 |
| - {{- "🚧" if waived is true else |
14 |
| - "" if waived is false else |
15 |
| - "❓" -}} |
| 35 | + {{- WAIVED_EMOJI(waived) -}} |
16 | 36 | {% endmacro %}
|
17 | 37 |
|
18 | 38 | {% macro status_name(status) %}
|
|
24 | 44 | {% endmacro %}
|
25 | 45 |
|
26 | 46 | {% macro waived_status_emoji(waived, status) %}
|
27 |
| - {{- waived_emoji(waived) + status_emoji(status) -}} |
| 47 | + {{- WAIVED_STATUS_EMOJIS[(waived, status)] -}} |
28 | 48 | {% endmacro %}
|
29 | 49 |
|
30 | 50 | {% macro waived_status_badge(waived, status) %}
|
|
0 commit comments