Skip to content

Commit

Permalink
Add failing example.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaj committed Feb 6, 2022
1 parent 43d909f commit 994c657
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/simple/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,11 @@ fn test_issue_68() {
"Hello!\n\nThe 0 number.\n\nThe 1 number.\n\nThe 2 number.\n\nGood bye!\n",
);
}

#[test]
fn test_list_join() {
assert_eq!(
r2s(|o| list_joins(o, &[2, 3, 7])),
"<p>Items: 2, 3, 7.</p>\n",
)
}
6 changes: 6 additions & 0 deletions examples/simple/templates/list_joins.rs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@use super::{number_item, JoinHtml, JoinToHtml};

@(items: &[u8])

<p>Items: @items.iter().join_to_html(", ").</p>
<p>Items: @items.iter().cloned().join_html(number_item, ", ").</p>
2 changes: 2 additions & 0 deletions examples/simple/templates/number_item.rs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@(item: u8)
#@item

0 comments on commit 994c657

Please sign in to comment.