Skip to content

Commit

Permalink
chore: move triple backticks to Render
Browse files Browse the repository at this point in the history
Signed-off-by: Manfred Touron <[email protected]>
  • Loading branch information
moul committed Apr 3, 2023
1 parent 787ce07 commit 9417520
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
7 changes: 3 additions & 4 deletions examples/gno.land/r/demo/art/gnoface/gnoface.gno
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func Render(path string) string {
}

output := ufmt.Sprintf("Gnoface #%d\n", seed)
output += Draw(seed)
output += "```\n" + Draw(seed) + "```\n"
return output
}

Expand Down Expand Up @@ -104,8 +104,7 @@ func Draw(seed int64) string {

r := rand.FromSeed(seed)

return "```\n" +
pick(r, hairs) + "\n" +
return pick(r, hairs) + "\n" +
pick(r, headtop) + "\n" +
pick(r, headspace) + "\n" +
" | " + pick(r, eyebrow) + " " + pick(r, eyebrow) + " |\n" +
Expand All @@ -115,7 +114,7 @@ func Draw(seed int64) string {
pick(r, headspace) + "\n" +
pick(r, mouth) + "\n" +
pick(r, headspace) + "\n" +
pick(r, headbottom) + "\n```\n"
pick(r, headbottom) + "\n"
}

func pick(r *rand.Instance, slice []string) string {
Expand Down
14 changes: 7 additions & 7 deletions examples/gno.land/r/demo/art/gnoface/gnoface_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"gno.land/p/demo/ufmt"
)

func TestGnoface(t *testing.T) {
func TestDraw(t *testing.T) {
cases := []struct {
seed int64
expected string
}{
{
seed: 42,
expected: "```" + `
expected: `
|||||||
////////\
| |
Expand All @@ -25,11 +25,11 @@ func TestGnoface(t *testing.T) {
| __/ |
| |
\~~~~~~~/
` + "```\n",
`[1:],
},
{
seed: 1337,
expected: "```" + `
expected: `
s
/|||||||\
| |
Expand All @@ -41,11 +41,11 @@ o| ~ ~ |.
| __/ |
| |
\_______/
` + "```\n",
`[1:],
},
{
seed: 123456789,
expected: "```" + `
expected: `
s
/~~~~~~~\
| |
Expand All @@ -57,7 +57,7 @@ o| ~ ~ |.
| \_/ |
| |
\-------/
` + "```\n",
`[1:],
},
}
for _, tc := range cases {
Expand Down

0 comments on commit 9417520

Please sign in to comment.