aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-06-18 10:02:38 +0200
committerBad Diode <bd@badd10de.dev>2024-06-18 10:02:38 +0200
commit9c3837060d1089131b351761db97544db8738de3 (patch)
treec76087681b4a947dece76be90161c0a89918abd3 /tests
parentf392b0818e651ece33cec091eac0639883a126ec (diff)
downloadbdl-9c3837060d1089131b351761db97544db8738de3.tar.gz
bdl-9c3837060d1089131b351761db97544db8738de3.zip
Add struct literals
Diffstat (limited to 'tests')
-rw-r--r--tests/variables.bad24
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/variables.bad b/tests/variables.bad
index a6f9900..a653dc7 100644
--- a/tests/variables.bad
+++ b/tests/variables.bad
@@ -2,14 +2,12 @@
2; inferred, but can also be manually specified. 2; inferred, but can also be manually specified.
3let a 3let a
4let b: f64 4let b: f64
5let c = 10 5let c:u64 = 20
6let d:u64 = 20
7 6
8; No infix '=', instead we use `set` to bind values. 7; No infix '=', instead we use `set` to bind values.
9set a = "hello" 8set a = "hello"
10set b = 1.2 9set b = 1.2
11set c = 30 10set c = (1 + 2 - 3)
12set d = (1 + 2 - 3)
13 11
14; Struct definitions. 12; Struct definitions.
15struct vec { 13struct vec {
@@ -46,12 +44,12 @@ struct entity {
46} 44}
47 45
48; Symbols followed by curly braces output struct literals. 46; Symbols followed by curly braces output struct literals.
49; let particle = entity { 47let particle = entity {
50; ; Two ways of initializing inner fields. 48 ; Two ways of initializing inner fields.
51; pos = { 1 2 } 49 pos = vec { x = 1 y = 2 }
52; attr.id = 1 50 attr.id = 1
53; attr.name = "particle" 51 attr.name = "particle"
54 52
55; ; Missing initialization fields default to zero. 53 ; Missing initialization fields default to zero.
56; vel = { -3 } 54 vel = vec { y = -3 }
57; } 55}