summaryrefslogtreecommitdiff
path: root/tests/control_flow
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-18 15:57:40 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-18 15:57:40 +0000
commit43c4f78eb3d2af7778bab6e51d77588bec62930d (patch)
treef8614e429ef913467420af7d08d104030ec6d434 /tests/control_flow
parenta7eceb21faf04762379f2ce4d23d21bbc8c11929 (diff)
Update docs + add '..<' + add typed embed.
Diffstat (limited to 'tests/control_flow')
-rw-r--r--tests/control_flow/test_loops.zc8
-rw-r--r--tests/control_flow/test_match.zc3
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/control_flow/test_loops.zc b/tests/control_flow/test_loops.zc
index 882ae7b..60ccc50 100644
--- a/tests/control_flow/test_loops.zc
+++ b/tests/control_flow/test_loops.zc
@@ -164,3 +164,11 @@ test "exclusive range regression check" {
}
assert(count3 == 5, "Expected 5 iterations for 0..5")
}
+
+test "explicit exclusive range (..<)" {
+ var count4 = 0
+ for i in 0..<5 {
+ count4 += 1
+ }
+ assert(count4 == 5, "Expected 5 iterations for 0..<5")
+}
diff --git a/tests/control_flow/test_match.zc b/tests/control_flow/test_match.zc
index bf757b1..ca185ae 100644
--- a/tests/control_flow/test_match.zc
+++ b/tests/control_flow/test_match.zc
@@ -24,7 +24,8 @@ fn classify_extended(n: int) -> int {
match n {
1 || 2 => { return 100; }, // OR pattern with ||
3 or 4 => { return 200; }, // OR pattern with 'or'
- 5..8 => { return 300; }, // Range exclusive (5, 6, 7)
+ 5..<8 => { return 300; }, // Use ..< for exclusive range (originally 5..8)
+ 8..8 => { return 305; }, // Single valid? (empty range)
10..=15 => { return 400; }, // Range inclusive (10-15)
_ => { return -1; }
}