diff options
author | Bad Diode <bd@badd10de.dev> | 2024-06-21 18:20:35 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2024-06-21 18:20:35 +0200 |
commit | 835f4d9f23f55a973d76ae9384b7b9d75da5472b (patch) | |
tree | 8e817452f8437db07688cb6e63a1a73bcce543eb /tests | |
parent | 5a25eeefd13b0e1988ecaf7e497ebde81e71bb2e (diff) | |
download | bdl-835f4d9f23f55a973d76ae9384b7b9d75da5472b.tar.gz bdl-835f4d9f23f55a973d76ae9384b7b9d75da5472b.zip |
Remove old files no longer needed as reference
Diffstat (limited to 'tests')
-rw-r--r-- | tests/semantics.bad | 88 |
1 files changed, 50 insertions, 38 deletions
diff --git a/tests/semantics.bad b/tests/semantics.bad index 2e6e7c3..d050426 100644 --- a/tests/semantics.bad +++ b/tests/semantics.bad | |||
@@ -1,54 +1,66 @@ | |||
1 | fun nested(): u32 { | ||
2 | fun adder(a: u32, b: u32): u32 a + b | ||
3 | if (1 + 1) { | ||
4 | { | ||
5 | let b = 32 | ||
6 | } | ||
7 | } | ||
8 | adder(1,2) | ||
9 | } | ||
10 | |||
1 | enum field { | 11 | enum field { |
2 | a | 12 | a |
3 | b | 13 | b |
4 | } | 14 | } |
5 | 15 | ||
6 | ; fun foo(): nil { | 16 | struct vec { |
7 | ; bar() | 17 | a: int |
8 | ; } | 18 | b: int |
19 | } | ||
9 | 20 | ||
10 | ; fun bar(): nil { | 21 | fun foo(): nil { |
11 | ; foo() | 22 | bar() |
12 | ; } | 23 | } |
13 | 24 | ||
14 | ; ; There are some builtint functions. | 25 | fun bar(): nil { |
15 | ; println("hello world") | 26 | foo() |
27 | } | ||
16 | 28 | ||
17 | ; ; Let/set. | 29 | ; There are some builtint functions. |
18 | ; let num = 1 | 30 | println("hello world") |
19 | ; set num = 2 | ||
20 | ; set num = 0 + num | ||
21 | 31 | ||
22 | ; ; Loops and conditionals. | 32 | ; Let/set. |
23 | ; if (num) 3 else 1 | 33 | let num = 1 |
24 | ; let val = if (2 + num == 4) num else num | 34 | set num = 2 |
25 | ; if (true) { | 35 | set num = 0 + num |
26 | ; let c = 1 | ||
27 | ; 1 + 1 + c | ||
28 | ; } | ||
29 | 36 | ||
30 | ; match (num) { | 37 | ; Loops and conditionals. |
31 | ; case 1 = 23 | 38 | if (num) 3 else 1 |
32 | ; case 2 = num | 39 | let val = if (2 + num == 4) num else num |
33 | ; else = num | 40 | if (true) { |
34 | ; } | 41 | let c = 1 |
42 | 1 + 1 + c | ||
43 | } | ||
35 | 44 | ||
36 | ; cond { | 45 | fun testmatches(): nil { |
37 | ; case 1 == 1 = 23 | 46 | match (num) { |
38 | ; case 2 != 1 = num | 47 | case 1 = 23 |
39 | ; else = num | 48 | case 2 = num |
40 | ; } | 49 | else = num |
50 | } | ||
41 | 51 | ||
42 | ; while (num == 1) num | 52 | cond { |
43 | ; while (true) { | 53 | case 1 == 1 = 23 |
44 | ; let c = 1 | 54 | case 2 != 1 = num |
45 | ; 1 + 1 + c | 55 | else = num |
46 | ; } | 56 | } |
57 | } | ||
47 | 58 | ||
48 | ; fun nested(): u32 { | 59 | while (num == 1) num |
49 | ; fun adder(a: u32, b: u32): u32 a + b | 60 | while (true) { |
50 | ; adder(1,2) | 61 | let c = 1 |
51 | ; } | 62 | 1 + 1 + c |
63 | } | ||
52 | 64 | ||
53 | ; This should err. | 65 | ; This should err. |
54 | ; fun foo(): nil { | 66 | ; fun foo(): nil { |