aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-06-26 17:36:21 +0200
committerBad Diode <bd@badd10de.dev>2024-06-26 17:36:21 +0200
commit3b9cfd8b515d5b2969e242ea730792ae26f5fbfe (patch)
treefcc2a9f518481d612a304bc374f247be090bf9e2 /tests
parenta93323df87caeb345df74a2141c72d591db91c7b (diff)
downloadbdl-3b9cfd8b515d5b2969e242ea730792ae26f5fbfe.tar.gz
bdl-3b9cfd8b515d5b2969e242ea730792ae26f5fbfe.zip
Add enum de-structuring and int matching on match expr
Diffstat (limited to 'tests')
-rw-r--r--tests/semantics.bad25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/semantics.bad b/tests/semantics.bad
index 8a2818f..e5178f2 100644
--- a/tests/semantics.bad
+++ b/tests/semantics.bad
@@ -14,6 +14,17 @@ struct vec {
14 } 14 }
15} 15}
16let a = 1 16let a = 1
17
18match a {
19 case 1 = "ha"
20 case 2 = "ho"
21}
22
23cond {
24 1 == 1 = "ha"
25 2 != 2 = "ho"
26}
27
17; struct vec { 28; struct vec {
18; x: f64 29; x: f64
19; y: f64 30; y: f64
@@ -90,9 +101,21 @@ enum weekdays {
90 sat 101 sat
91 sun 102 sun
92} 103}
93; let a = weekdays.tue 104let d = weekdays.tue
94; let b = a 105; let b = a
95 106
107match 1 {
108 case 2 = "monday"
109 case 3 = "tuesday"
110 else = "whateverday"
111}
112
113match d {
114 case mon = "monday"
115 case tue = "tuesday"
116 else = "whateverday"
117}
118
96; struct item { 119; struct item {
97; id: int 120; id: int
98; name: str 121; name: str