mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
add pretty print
This commit is contained in:
parent
1a77e710d5
commit
76af14a9f4
11 changed files with 114 additions and 5 deletions
|
|
@ -120,3 +120,23 @@ if not_run {
|
|||
}
|
||||
"#
|
||||
);
|
||||
|
||||
run_test!(
|
||||
fizzbuzz,
|
||||
r#"
|
||||
let i = 1;
|
||||
|
||||
while i < 100 {
|
||||
if i % 15 == 0 {
|
||||
print "FizzBuzz";
|
||||
} else if i % 5 == 0 {
|
||||
print "Buzz";
|
||||
} else if i % 3 == 0 {
|
||||
print "Fizz";
|
||||
} else {
|
||||
print i;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
"#
|
||||
);
|
||||
|
|
|
|||
7
tests/snapshots/control_flow__fizzbuzz.snap
Normal file
7
tests/snapshots/control_flow__fizzbuzz.snap
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
source: tests/control_flow.rs
|
||||
assertion_line: 124
|
||||
expression: output
|
||||
|
||||
---
|
||||
"1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n31\n32\nFizz\n34\nBuzz\nFizz\n37\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n46\n47\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\n"
|
||||
Loading…
Add table
Add a link
Reference in a new issue