summaryrefslogtreecommitdiff
path: root/share/rust/template/template.rs.tera
blob: c94d63c52ea73b8b4c530b278d5c1ebd9220c2ac (plain)
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
{% import "macros.rs.tera" as macros %}

use subplotlib::prelude::*;

{% for func in functions %}

// --------------------------------
// This came from {{ func.source }}

{{ func.code }}

{% endfor %}

// --------------------------------

lazy_static! {
    static ref SUBPLOT_EMBEDDED_FILES: Vec<SubplotDataFile> = vec![
{% for file in files %}
        SubplotDataFile::new("{{ file.filename | base64 }}",
                             "{{ file.contents | base64 }}"),
{% endfor %}
    ];
}

{% for scenario in scenarios %}

// ---------------------------------

// {{ scenario.title | commentsafe }}
#[test]
fn {{ scenario.title | nameslug }}() {
    let mut scenario = Scenario::new(&base64_decode("{{scenario.title | base64}}"));
    {% for step in scenario.steps %}
    let step = {{ macros::builder(stepfn=step.function, step=step) }};
    {%- if step.cleanup %}
    let cleanup = {{ macros::builder(stepfn=step.cleanup, step=step) }};
    scenario.add_step(step, Some(cleanup));
    {%- else %}
    scenario.add_step(step, None);
    {%- endif %}
    {% endfor %}

    scenario.run().unwrap();
}
{% endfor %}