-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Move hello world to its own user_story
- Loading branch information
Showing
2 changed files
with
17 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,5 @@ | ||
import gleam/dict | ||
import gleam/dynamic | ||
import gleam/io | ||
import gleam/list | ||
import gleeunit | ||
import gleeunit/should | ||
import handles | ||
|
||
pub fn main() { | ||
gleeunit.main() | ||
} | ||
|
||
pub fn handles_hello_world_test() { | ||
handles.prepare("Hello {{name}}") | ||
|> should.be_ok | ||
|> handles.run( | ||
dict.new() | ||
|> dict.insert("name", "Oliver") | ||
|> dynamic.from, | ||
) | ||
|> should.be_ok | ||
|> should.equal("Hello Oliver") | ||
} | ||
|
||
pub fn handles_loop_test() { | ||
handles.prepare("{{#each knattarna}}Hello {{name}}\n{{/each}}") | ||
|> should.be_ok | ||
|> io.debug | ||
|> handles.run( | ||
dict.new() | ||
|> dict.insert( | ||
"knattarna", | ||
list.new() | ||
|> list.append([ | ||
dict.new() | ||
|> dict.insert("name", "Knatte") | ||
|> dynamic.from, | ||
dict.new() | ||
|> dict.insert("name", "Fnatte") | ||
|> dynamic.from, | ||
dict.new() | ||
|> dict.insert("name", "Tjatte") | ||
|> dynamic.from, | ||
]) | ||
|> dynamic.from, | ||
) | ||
|> dynamic.from, | ||
) | ||
|> should.be_ok | ||
|> should.equal("Hello Knatte\nHello Fnatte\nHello Tjatte\n") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import gleam/dict | ||
import gleam/dynamic | ||
import gleeunit/should | ||
import handles | ||
|
||
pub fn handles_hello_world_test() { | ||
handles.prepare("Hello {{name}}") | ||
|> should.be_ok | ||
|> handles.run( | ||
dict.new() | ||
|> dict.insert("name", "Oliver") | ||
|> dynamic.from, | ||
) | ||
|> should.be_ok | ||
|> should.equal("Hello Oliver") | ||
} | ||
|