Skip to content

Commit 9a4a9e7

Browse files
committed
improve test template
Some test descriptions have commas and other shenanigans in them. `slugify` solves all those problems with one filter.
1 parent df6dc30 commit 9a4a9e7

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

exercises/practice/acronym/.meta/test_template.tera

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% if loop.index != 1 -%}
44
#[ignore]
55
{% endif -%}
6-
fn {{ test.description | lower | replace(from=" ", to="_") }}() {
6+
fn {{ test.description | slugify | replace(from="-", to="_") }}() {
77
let input = {{ test.input.phrase | json_encode() }};
88
let output = {{ crate_name }}::{{ fn_names[0] }}(input);
99
let expected = {{ test.expected | json_encode() }};

rust-tooling/src/default_test_template.tera

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% if loop.index != 1 -%}
44
#[ignore]
55
{% endif -%}
6-
fn {{ test.description | lower | replace(from=" ", to="_") }}() {
6+
fn {{ test.description | slugify | replace(from="-", to="_") }}() {
77
let input = {{ test.input | json_encode() }};
88
let output = {{ crate_name }}::{{ fn_names[0] }}(input);
99
let expected = {{ test.expected | json_encode() }};

0 commit comments

Comments
 (0)