diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-01-11 16:05:01 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-01-11 16:05:10 +0100 |
| commit | f957f0ba7bce1c1fb18df37cc11bb3906b96735f (patch) | |
| tree | a74900aff74e3bc24d700ec800b39bc13d63084e | |
| parent | 711968ffb31ee06630ed43740fd2538becc2765b (diff) | |
| download | sylt-f957f0ba7bce1c1fb18df37cc11bb3906b96735f.tar.gz | |
test ifs
| -rw-r--r-- | src/main.rs | 1 | ||||
| -rw-r--r-- | tests/if.tdy | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index a2b5dae..e25aab4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,4 +76,5 @@ mod tests { test_file!(order_of_operations, "tests/order-of-operations.tdy"); test_file!(variables, "tests/variables.tdy"); test_file!(scoping, "tests/scoping.tdy"); + test_file!(ifs, "tests/if.tdy"); } diff --git a/tests/if.tdy b/tests/if.tdy new file mode 100644 index 0000000..196e221 --- /dev/null +++ b/tests/if.tdy @@ -0,0 +1,29 @@ +a int := 0 +res int := 0 + +if 1 == 2 { + <!> +} + +a = 1 +if a == 0 { + <!> +} + +a = 1 +res = 0 +if a == 1 { + res = 1 +} +res <=> 1 + +a = 1 +res = 0 +if a == 0 { + <!> +} else if a == 1 { + res = 1 +} else { + <!> +} +res <=> 1 |
