馃惁鈥嶁瑳 Snapshot testing in Gleam
at main 678 B view raw
1import birdie 2import gleam/string 3import gleeunit 4 5pub fn main() { 6 gleeunit.main() 7} 8 9pub fn hello_birdie_test() { 10 "馃惁鈥嶁瑳 smile for the birdie!" 11 |> birdie.snap(title: "my first snapshot") 12} 13 14pub fn a_result_test() { 15 string.inspect(Ok(11)) 16 |> birdie.snap(title: "my favourite number wrapped in a result") 17} 18 19pub fn list_test() { 20 "[ 1, 2, 3, 4 ]" 21 |> birdie.snap(title: "snapping a list of numbers") 22} 23 24pub fn complex_function_test() { 25 "case foo(bar, baz) { 26 True -> 27 io.println(\"Phew, we don't have to launch the missiles...\") 28 False -> { 29 io.println(\"Not foo!\") 30 launch_missiles() 31 } 32}" 33 |> birdie.snap(title: "diffing a case expression") 34}