Skip to content

Commit

Permalink
unicode tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jverzani committed Jun 28, 2015
1 parent 05d9615 commit 45a786b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ As well, one can use Composite Kinds. This may make writing `show` methods easie

```
using Distributions
tpl = "Beta distribution with alpha={{alpha}}, beta={{beta}}"
tpl = "Beta distribution with alpha={{α}}, beta={{β}}"
render(tpl, Beta(1, 2))
```

Expand Down Expand Up @@ -130,8 +130,10 @@ variable is *not* defined.

### Iteration

If the section variable binds to an iterable collection, then the text
in the section is repeated for each item in the collection.
If the section variable, `{{#VARNAME}}`, binds to an iterable
collection, then the text in the section is repeated for each item in
the collection with the view used for the context of the template
given by the item.

This is useful for collections of named objects, such as DataFrames
(where the collection is comprised of rows) or arrays of
Expand Down
10 changes: 10 additions & 0 deletions test/Mustache_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@ tpl = "a:{{:a}} b:{{:b}}"

## keyword args
@test render(tpl, a="ex", b="why") == "a:ex b:why"

## unicode
module TMP
α = 1
β = 2
end
@test render("{{α}} + 1 = {{β}}", TMP) == "1 + 1 = 2"
@test render("{{:β}}", β=2) == "2"
@test render("α - {{:β}}", β=2) == "α - 2"
@test render("{{:α}}", α="β") == "β"

0 comments on commit 45a786b

Please sign in to comment.