diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-12-05 11:33:24 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-12-21 08:39:32 +0000 |
commit | a1ffaea8703126af20f2a4a61fa53fea8c17e218 (patch) | |
tree | 2daf4e78837957adef53c2d2328e52afd38e48c8 /templates | |
parent | e224ec2d7cbea36dcea43f2b0b5cb20c75c8c502 (diff) | |
download | subplot-a1ffaea8703126af20f2a4a61fa53fea8c17e218.tar.gz |
rust: Use commentsafe filter in rust template
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/rust/template.rs.tera | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/templates/rust/template.rs.tera b/templates/rust/template.rs.tera index f1b0580..a60599f 100644 --- a/templates/rust/template.rs.tera +++ b/templates/rust/template.rs.tera @@ -24,7 +24,7 @@ lazy_static! { // --------------------------------- -// {{ scenario.title }} +// {{ scenario.title | commentsafe }} #[test] fn {{ scenario.title | nameslug }}() { let mut scenario = Scenario::new(&base64_decode("{{scenario.title | base64}}")); @@ -33,13 +33,17 @@ fn {{ scenario.title | nameslug }}() { {% for part in step.parts %}{% if part.CapturedText is defined -%} {%- set name = part.CapturedText.name -%} {%- set text = part.CapturedText.text -%} - {%- set type = step.types[name] | default(value='string') -%} + {%- set type = step.types[name] | default(value='text') -%} .{{name}}( - {% if type in ['number', 'raw', 'literal'] %}{{text}} - {% elif type in ['string']%}&base64_decode("{{text | base64}}") - {% elif type in ['file'] %} + {% if type in ['number', 'int', 'uint'] %}{{text}} + {%- elif type in ['text', 'word']%} + // "{{text | commentsafe }}" + &base64_decode("{{text | base64}}" + ) + {%- elif type in ['file'] %} { use std::path::PathBuf; + // {{ text | commentsafe }} let target_name: PathBuf = base64_decode("{{ text | base64 }}").into(); SUBPLOT_EMBEDDED_FILES .iter() @@ -47,7 +51,7 @@ fn {{ scenario.title | nameslug }}() { .expect("Unable to find file at runtime") .clone() } - {% else %} /* WOAH */ {{text}} + {%- else %} /* WOAH unknown type {{step.types[name]}} */ {{text}} {%- endif %} ) {% endif -%} @@ -63,4 +67,4 @@ fn {{ scenario.title | nameslug }}() { scenario.run().unwrap(); } -{% endfor %}
\ No newline at end of file +{% endfor %} |