Skip to content

Commit

Permalink
tests: replace template humanbytes test with minijinja_contrib::fil…
Browse files Browse the repository at this point in the history
…esizeformat test
  • Loading branch information
jqnatividad committed Nov 18, 2024
1 parent f18b498 commit d0c023c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ fn template_custom_filters() {
wrk.create_from_string(
"template.txt",
"Name: {{ name|substr(0,2) }}\nAmount: {{ amount|human_count }}\nBytes: {{ \
bytes|human_bytes }}\nScore (2 decimals): {{ score|format_float(2) }}\nScore (rounded): \
{{ score|round_num(1) }}\nActive: {{ active|str_to_bool }}\nFloat with commas: {{ \
amount|human_float_count }}\n\n",
bytes|float|filesizeformat }} {{bytes|float|filesizeformat(true) }}\nScore (2 decimals): \
{{ score|format_float(2) }}\nScore (rounded): {{ score|round_num(1) }}\nActive: {{ \
active|str_to_bool }}\nFloat with commas: {{ amount|human_float_count }}\n\n",
);

let mut cmd = wrk.command("template");
Expand All @@ -361,14 +361,14 @@ fn template_custom_filters() {
let got: String = wrk.stdout(&mut cmd);
let expected = r#"Name: Jo
Amount: 1,234,567
Bytes: 1.00 MiB
Bytes: 1.0 MB 1.0 MiB
Score (2 decimals): 3.14
Score (rounded): 3.1
Active: true
Float with commas: 1,234,567
Name: Ja
Amount: <FILTER_ERROR>
Bytes: 1.00 GiB
Bytes: 1.1 GB 1.0 GiB
Score (2 decimals): 2.72
Score (rounded): 2.7
Active: false
Expand Down

0 comments on commit d0c023c

Please sign in to comment.