aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-06-26 17:45:55 +0200
committerBad Diode <bd@badd10de.dev>2024-06-26 17:45:55 +0200
commitde360fb4023c4a18961817bcdb248e0720de7ec7 (patch)
treee77c02a57dcccd2ece2ed17ff13f89763ef1bc17 /tests
parent3b9cfd8b515d5b2969e242ea730792ae26f5fbfe (diff)
downloadbdl-de360fb4023c4a18961817bcdb248e0720de7ec7.tar.gz
bdl-de360fb4023c4a18961817bcdb248e0720de7ec7.zip
Fix a segfault
Diffstat (limited to 'tests')
-rw-r--r--tests/conditionals.bad13
-rw-r--r--tests/loops.bad7
-rw-r--r--tests/variables.bad20
3 files changed, 14 insertions, 26 deletions
diff --git a/tests/conditionals.bad b/tests/conditionals.bad
index 772bd07..aca5c36 100644
--- a/tests/conditionals.bad
+++ b/tests/conditionals.bad
@@ -36,15 +36,10 @@ enum flags {
36} 36}
37let f:flags = flags.node_add 37let f:flags = flags.node_add
38 38
39; TODO: No need to qualify enum fields inside match-case. 39; No need to qualify enum fields inside match-case.
40; match (a) { 40match f {
41; case node_add = "adding something..." 41 case node_add = "adding something..."
42; case node_add = "subbing something..." 42 case node_add = "subbing something..."
43; else = "default case"
44; }
45match a {
46 case flags.node_add = "adding something..."
47 case flags.node_add = "subbing something..."
48 else = "default case" 43 else = "default case"
49} 44}
50 45
diff --git a/tests/loops.bad b/tests/loops.bad
index a068ed0..be2628e 100644
--- a/tests/loops.bad
+++ b/tests/loops.bad
@@ -16,10 +16,5 @@ while i < 10 {
16 "hello" 16 "hello"
17 ; --i 17 ; --i
18} 18}
19; TODO: add post/pre increment tokens
20; TODO: add functions
21; TODO: add function calls
22
23; for let i = 1, 1 < 10, i++ {
24 19
25; } 20; TODO: add post/pre increment tokens
diff --git a/tests/variables.bad b/tests/variables.bad
index 34293dc..ce765bc 100644
--- a/tests/variables.bad
+++ b/tests/variables.bad
@@ -33,27 +33,25 @@ let player_b = player_a
33struct entity { 33struct entity {
34 pos: vec 34 pos: vec
35 vel: vec 35 vel: vec
36 ; TODO: ... 36 attr: {
37 ; attr: { 37 id: int
38 ; id: u64 38 name: str
39 ; name: str 39 }
40 ; }
41} 40}
42 41
43; Symbols followed by curly braces output struct literals. 42; Symbols followed by curly braces output struct literals.
44let particle = entity : { 43let particle = entity : {
45 ; Two ways of initializing inner fields. 44 ; Two ways of initializing inner fields.
46 pos = vec : { x = 1.0 y = 2.0 } 45 pos = vec : { x = 1.0 y = 2.0 }
47 ; TODO: Get rid of this, unnecessary complexity on the implementation, let's 46 attr = {
48 ; just do the top option. 47 id = 1
49 ; attr.id = 1 48 name = "particle"
50 ; attr.name = "particle" 49 }
51 50
52 ; Missing initialization fields default to zero. 51 ; Missing initialization fields default to zero.
53 vel = vec : { y = -3.0 } 52 vel = vec : { y = -3.0 }
54} 53}
55; let particle = entity : {} 54set particle = entity : {}
56; TODO: Now we can get rid of parenthesis on if/while statements
57 55
58; ; We can have static arrays and have indexed access. 56; ; We can have static arrays and have indexed access.
59; let numbers: u32[0xff] 57; let numbers: u32[0xff]